[C++-sig] Re: __call__?

David Abrahams dave at boost-consulting.com
Thu Jul 15 14:33:13 CEST 2004


"Neal D. Becker" <ndbecker2 at verizon.net> writes:

> How does one overload __call__?  It doesn't seem to be included in
> <boost/python/operators.hpp> or mentioned in the tutorial.

You add your operator() as a method called "__call__" ;-)

  class_<Foo>("Foo")
    .def("__call__", &Foo::operator())
    ...
    ;

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com




More information about the Cplusplus-sig mailing list