[C++-sig] [boost.python] Interoperability with boost.bind

Markus Schöpflin markus.schoepflin at comsoft.de
Mon Jul 4 13:21:37 CEST 2005


David Abrahams wrote:

> Markus Schöpflin <markus.schoepflin at comsoft.de> writes:

>>Is boost.python compatible with boost.bind (see example below)? 

> Not in that way, no.  The requirements of def() are clearly spelled
> out in http://www.boost.org/libs/python/doc/v2/def.html#def-spec, and
> bind_t<> specializations do not meet them ... mostly because I don't
> have a way to deduce the signature of a bind expression.
> 
> However, you can do:
> 
>     def(
>         "foo"
>       , make_function(
>             bind(foo,_1)
>           , default_call_policies()
>           , boost::mpl::vector<int,int>()
>         )
>     )
> 
> See http://www.boost.org/libs/python/doc/v2/make_function.html

Thanks for the answer, Dave. IOW, if there would be a way to get the 
signature of the bind expression, maybe via some support from bind itself, 
there would be a way to make to original example work, right?

Markus






More information about the Cplusplus-sig mailing list