[C++-sig] init from free function instead of constructor

John Reid j.reid at mail.cryst.bbk.ac.uk
Wed Jan 24 19:33:36 CET 2007


Hi,

I can't find anything in the documentation that lets me do this:

class X { };
X make_x( std::string );

using namespace boost::python;

class_<X>(
	"X",
	"This is X's docstring.",
	init<std::string>( make_x ) )
;

Is it true that I can only make python __init__ functions from 
constructors as opposed to free functions such as make_x()?

Thanks,
John.




More information about the Cplusplus-sig mailing list