Is there a difference between wrapping the contents of the header content and cpp in the namespace or wrapping only the contents of the header and then using the namespace using the namespace
?
In difference, I mean any arbitrary performance deviation or slightly different semantics that might cause problems or something I need to know.
Example:
// header namespace X { class Foo { public: void TheFunc(); }; } // cpp namespace X { void Foo::TheFunc() { return; } }
VS
// header namespace X { class Foo { public: void TheFunc(); }; } // cpp using namespace X; { void Foo::TheFunc() { return; } }
If it makes no difference, what is the preferred form and why?
c ++ namespaces
links77 Nov 21 '11 at 11:19 2011-11-21 11:19
source share