[C++-sig] boost::variant in Python interface

Colin Irwin colin_irwin at hotmail.com
Mon Mar 29 02:52:46 CEST 2004

I have a C++ interface that I would like to make available in a
corresponding Python module.  The interface contains a member function that
returns a vector of boost::variants, with the variant being one of three
possible types.  I've used the boost::python::vector_indexing_suite class to
wrap the vector up, so far so good.  However, the core of the problem is how
to wrap the variant type up.

To provide a more concrete example, I have provided a sample implementation

class BaseData { ... };
class DataType1 : public BaseData { ... };
class DataType2 : public BaseData { ... };
class DataType3 : public BaseData { ... };

class DataProducer
        typedef boost::variant<
        void ReceiveData(std::vec

More information about the Cplusplus-sig mailing list