c++ - Using directive in header files in private namespace -


I have a template class which uses some boost functions in its methods because this is a square template, this method is a Header should be implemented in the file. I use some using announcements to make the code more readable:

  Namespace Network {Namespace v1 {Namespace Details {boost :: phoenix :: if_ ; Promotion: use of_each; / * Some more functions * / Templates & lt; Class T & gt; Class some {public: some () {for_each (inwetters, / * some phoenix code * /); } Private: Vector & lt; Int & gt; IntVector; }; } Template & lt; Square T & gt; Some = using the details: some & lt; T & gt; }}  

Is it safe to use in a header? I do not think anyone ever uses a namespace network :: v1 :: detail> using one. CPP file is used, so I do not expect that the name added to the extension name space will cause any name collision. Am i wrong

Yes, it is safe I have used announcements only to add extension work to extension namespace. As the answer to your question: -)

Edit: Another thought: Even if anyone use your name extension and name space to promote at the same time, for_each etc. There will still be a single celebration, so that the surname will not be a problem. If the names then provide a for_each to collide with other libraries, you can also differentiate the use of the function by prefixing the namespace. But if anyone is not using using your namespace , then you are okay.


Comments