Boost Python Export Singleton
I have a singleton (from boost::serialization): class LogManager : public boost::serialization::singleton { ... }; And wrapper for getting instance: inline LogMa
Solution 1:
In addition to using bases<...>
in the second argument as Autopulated pointed out, I think you also want to specifiy boost::noncopyable
as the third template argument, e.g.
bp::class_<LogManager, bp::bases<boost::serialization::singleton<LogManager> >, boost::noncopyable>("LogManager", bp::no_init)
Edit: Also, you need have a class declaration for any base classes listed, e.g.
bp::class_<boost::serialization::singleton<LogManager>, boost::noncopyable>("Singleton", bp::no_init)
Or, if you don't need access to the base class and won't be exporting any other children of boost::serialization::singleton<LogManager>
, then you can omit specifying the base classes in the first place. That is, the following declaration is just fine if all you want to do is expose the LogManager
class:
bp::class_<LogManager, boost::noncopyable>("LogManager", bp::no_init)
Solution 2:
You want bp::bases< boost::serialization::singleton<LogManager> >
as the second template parameter instead.
Post a Comment for "Boost Python Export Singleton"