[python] Alternative to explicitly defining function pointers?

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

On Monday 12 October 2009 04:07:26 Boris Schaeling wrote:
Is it possible to simplify this code without defining a function pointer?
No, but please see recent discussions on cplusplus-sig for ideas for the future.
----- 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); -----
Regards, Ravi
participants (2)
-
Boris Schaeling
-
Ravi