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

David Abrahams dave at boost-consulting.com
Sat Jul 2 02:07:51 CEST 2005


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

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list