[C++-sig] Re: add_property and boost::bind?
David Abrahams
dave at boost-consulting.com
Wed Aug 4 23:44:44 CEST 2004
Max Khesin <MKhesin at liquidnet.com> writes:
> Is it possible to define a property using boost::python and pass it a
> boost::bind object instead of a function pointer? e.g something like
>
>
> struct Foo
> {
> int lookup(const char*);
> };
>
>
> class_<Foo>("Foo")
> .add_property("aaa", boost::bind(&Foo::lookup, "aaa"))
> ;
You can use make_function with a Signature parameter and pass that to
add_property. But your bind expression above won't work.
Maybe something like:
.add_property("aaa",
make_function(
boost::bind(&Foo::lookup, _1, "aaa")
, default_call_policies()
, mpl::vector1<int>()
)
)
??
--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com
More information about the Cplusplus-sig
mailing list