
12 Oct
2009
12 Oct
'09
8:07 a.m.
Is it possible to simplify this code without defining a function pointer? ----- struct X { void y(std::string) { } std::string y() { return ""; } }; std::string (X::*get_y)() = &X::y; class_<X>("X").add_property("y", get_y); ----- I tried to set the signature but if the documentation is right signatures only make sense for function objects - so this code doesn't work: class_<X>("X").add_property("y", make_function(&X::y, default_call_policies(), mpl::vectorstd::string())); Anything else Boost.Python offers to make adding properties even easier? If there is nothing I know at least that I didn't miss a shortcut and have to define function pointers myself. Boris