You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by Apache Wiki <wi...@apache.org> on 2006/10/19 12:11:48 UTC

[Qpid Wiki] Trivial Update of "CppTips/NoUsingNamespaceInHeaders" by MarnieMcCormack

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Qpid Wiki" for change notification.

The following page has been changed by MarnieMcCormack:
http://wiki.apache.org/qpid/CppTips/NoUsingNamespaceInHeaders

------------------------------------------------------------------------------
+ MIGRATED to http://cwiki.apache.org/confluence/display/qpid/NoUsingNamespaceInHeaders
+ 
  Don't use the `using namespace ...` or `using ...` constructs in a header file. It might save you some typing but it also forces the namespaces you use onto every `.cpp` file that directly or indirectly includes your headers. That could create name clashes with names in some other namespace that the author of the `.cpp` file wants to use. Use fully qualified names, painful as it might be.
  
  There is one exception. It's sometimes handy to "import" names from one namespace to another. For example suppose some C++ compiler doesn't provide the `std::tr1::auto_ptr` template, which is used in qpid. [www.boost.org Boost] does provide a compatible `boost::auto_ptr` but it's in the boost namespace and qpid expects it in `std::tr1`. No problem, we create our own tr1/memory header file: