Name collision between c++ library namespace and C linux function
<p>The Linux <code>&lt;ncurses.h&gt;</code> header defines the function <a href="http://linux.die.net/man/3/meta" rel="nofollow"><code>meta</code></a>, and the C++ metaprogramming library <a href="https://github.com/ericniebler/meta" rel="nofollow"><code>meta</code></a> puts all its code in the global namespace <code>meta</code>. </p>

<p>How can I use both in the same C++ program (not necessarily the same TU but that would be nice)? Is there a way to work around the name collision?</p>

<p>I can think of two brittle workarounds, but they are easy to break:</p>

<ul>
<li><p>Workaround A:</p>

<pre><code> namespace linux {
 #include &lt;ncurses.h&gt;
 }  // namespace linux
 using linux::max_align_t;  // ncurses assumes it is in the global namespace
 #include &lt;meta/meta.hpp&gt;
</code></pre>

<p>compiles but will probably fail to link since the <code>ncurses</code> symbols are expected in the global namespace.</p></li>
<li><p>Workaround B:</p>

<pre><code>#include &lt;ncurses.h&gt;
namespace cpp {
#include &lt;meta/meta.hpp&gt;
}  // namespace cpp
</code></pre>

<p>is very brittle since it will only work as long as the <code>meta</code> library doesn't assume that any of its symbols are in the global namespace. That is, if the library needs to disambiguate internally a symbol and uses <code>::meta::symbol_name</code> for that, this approach will break.</p></li>
</ul>