logo       

Re: def( str( self)) error: msg#00256

python.c++

Subject: Re: def( str( self)) error

Jonathan Brandmeyer <jbrandmeyer@xxxxxxxxxxxxx> writes:

> using namespace boost::python;
>
> BOOST_PYTHON_MODULE(libphysics)
> {
> class_< physics::vector>( "vector")
> .def( str( self))
> ;
> }
>
> compiled with:
> $ g++-3.2 -c -o testme.lo -fpic -I/usr/include/python2.2 testme.cpp
> testme.cpp: In function `void init_module_libphysics()':
> testme.cpp:67: no matching function for call to `
> boost::python::class_<physics::vector,
> boost::python::detail::not_specified,
> boost::python::detail::not_specified,
> boost::python::detail::not_specified>
> ::def(boost::python::str)'

Easy workaround:

BOOST_PYTHON_MODULE(libphysics)
{
class_< physics::vector>( "vector")
.def( self_ns::str( self))
^^^^^^^^^
;
}

GCC seems to have some problems with the Koenig Lookup rules :(.

-Dave

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise