Boost python python export efficiency

I have singleton (from boost :: serialization):

class LogManager : public boost::serialization::singleton<LogManager> { ... };

And the shell to get the instance:

inline LogManager &logManager() { return LogManager::get_mutable_instance(); }

What is the correct way to associate this with boost.python module?

I tried:

class_< LogManager, boost::serialization::singleton<LogManager> >("LogManager", no_init)
    ...
;

The result is a lot of ugly error text in the console. What's wrong?

+3
source share
2 answers

In addition to being used bases<...>in the second argument specified as indicated by Autopulated, I think you also want to specify boost::noncopyableas the third argument to the template, for example.

bp::class_<LogManager, bp::bases<boost::serialization::singleton<LogManager> >, boost::noncopyable>("LogManager", bp::no_init)

Edit : In addition, you need to have a class declaration for any of the listed base classes, for example.

bp::class_<boost::serialization::singleton<LogManager>, boost::noncopyable>("Singleton", bp::no_init)

, boost::serialization::singleton<LogManager>, . , , , LogManager:

bp::class_<LogManager, boost::noncopyable>("LogManager", bp::no_init)
+4

bp::bases< boost::serialization::singleton<LogManager> > .

+1

All Articles