Here is an example: // c++ code
class A { public: enum ATypes { ONE, TWO, THREE }; }; // boost python code object obj_A = class_<A> ("A", "A simple A object", init<>() ) ; { scope in_A(obj_A); enum_<A:ATypes> ("ATypes") .value("ONE", A::ONE) .value("TWO", A::TWO) .value("THREE", A::THREE) ; } Hope that helps. Liam From: Cplusplus-sig [mailto:cplusplus-sig-bounces+herron=ellington....@python.org] On Behalf Of Deepankar Sharma Sent: Saturday, March 08, 2014 3:18 PM To: cplusplus-sig@python.org Subject: [C++-sig] How to wrap class enums Any pointers on how to expose class enums to Python? Given the following enum what would the boost code to expose it to python look like? The page at http://www.boost.org/doc/libs/1_55_0/libs/python/doc/v2/enum.html only lists examples of old style enums. enum class t_functions { ADD, SUB, MUL, DIV }; ============================================================================================= Email transmissions can not be guaranteed to be secure or error-free, as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of email transmission. In addition, the information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution,or copying of this communication, disclosure of the parties to it, or any action taken or omitted to be taken in reliance on it, is strictly prohibited, and may be unlawful. If you are not the intended recipient please delete this email message. ==============================================================================================
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig