I'm trying to expose a C++ enum and its comparison operators to Python using Boost.Python. I've defined the enum and comparison operators as shown in the code below:
This compiles fine but looks like python defines these comparison automatically hence does not care about my definitions at all and even if I throw in ltColor it does not throw in jupyter for example.
Still when I include the color.hpp in another file user.cpp, the code does not even compile:
I'm trying to expose a C++ enum and its comparison operators to Python using Boost.Python. I've defined the enum and comparison operators as shown in the code below:
This compiles fine but looks like python defines these comparison automatically hence does not care about my definitions at all and even if I throw in
ltColor
it does not throw in jupyter for example.Still when I include the color.hpp in another file user.cpp, the code does not even compile:
I get:
error LNK2005: "bool __cdecl operator<(enum Color,enum Color)" (??....) already defined in color_python.cpp.obj