summaryrefslogtreecommitdiff
path: root/documentation/content/xdocs/NoUsingNamespaceInHeaders.html
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/content/xdocs/NoUsingNamespaceInHeaders.html')
-rwxr-xr-xdocumentation/content/xdocs/NoUsingNamespaceInHeaders.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/documentation/content/xdocs/NoUsingNamespaceInHeaders.html b/documentation/content/xdocs/NoUsingNamespaceInHeaders.html
new file mode 100755
index 0000000000..7545bbfdd3
--- /dev/null
+++ b/documentation/content/xdocs/NoUsingNamespaceInHeaders.html
@@ -0,0 +1,49 @@
+<html>
+ <head>
+ <title>Apache Qpid : NoUsingNamespaceInHeaders</title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <div class="pageheader">
+ <span class="pagetitle">
+ Apache Qpid : NoUsingNamespaceInHeaders
+ </span>
+ </div>
+ <div class="pagesubheading">
+ This page last changed on Oct 19, 2006 by <font color="#0050B2">mmccorma</font>.
+ </div>
+
+ <p>Don't use the{{using namespace ...}} or <tt>using ...</tt> constructs in a header file. It might save you some typing but it also forces the namespaces you use onto every <tt>.cpp</tt> file that directly or indirectly includes your headers. That could create name clashes with names in some other namespace that the author of the <tt>.cpp</tt> file wants to use. Use fully qualified names, painful as it might be.</p>
+
+<p>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 <tt>std::tr1::auto_ptr</tt> template, which is used in qpid. <a href="http://www.boost.org" title="Visit page outside Confluence">Boost</a> does provide a compatible <tt>boost::auto_ptr</tt> but it's in the boost namespace and qpid expects it in <tt>std::tr1</tt>. No problem, we create our own tr1/memory header file:</p>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java">#include &lt;boost/memory&gt;
+namespace std {
+ namespace tr1 {
+ using boost::auto_ptr;
+ }
+}</pre>
+</div></div>
+
+<p>This makes the boost template available in the standard namespace. (Actually you don't need to do this yourself, boost provides a set of adapter headers for all the tr1 stuff.)</p>
+
+
+ </td>
+ </tr>
+ </table>
+ <table border="0" cellpadding="0" cellspacing="0" width="100%">
+ <tr>
+ <td height="12" background="border/border_bottom.gif"><img src="border/spacer.gif" width="1" height="1" border="0"/></td>
+ </tr>
+ <tr>
+ <td align="center"><font color="grey">Document generated by Confluence on Apr 22, 2008 02:47</font></td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file