ericniebler / meta

A tiny metaprogramming library
Boost Software License 1.0
302 stars 47 forks source link

Namespace collision #36

Closed pawelswoboda closed 8 years ago

pawelswoboda commented 8 years ago

When using meta and curses together, a name collision occurs, as there is a function called meta in curses, see http://linux.die.net/man/3/meta

gnzlbg commented 8 years ago

I don't know of any good standard way of solving this problem. The two following workarounds "work" but are ugly:

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

will probably fail to link, but since meta is header only the following might work fine as long as meta doesn't internally assume that its namespace is in the global namespace (which might assume as an implementation detail sooner or later):

#include <ncurses.h>
namespace cpp {
#include <meta/meta.hpp>
}  // namespace cpp

So... you can give any of these a try and see if it solves your problem, but these solution even if they seem to work are going to be very fragile. Is there a standard way of dealing with this issue?

gnzlbg commented 8 years ago

So I've asked this on SO: http://stackoverflow.com/questions/37393414/name-collision-between-c-library-namespace-and-c-linux-function

Seems that your best bet is to use the ncurses c++ bindings. If they are not shipped by your distribution they should be inside the ncurses source directory.