[C++-sig] Re: def( str( self)) error
David Abrahams
dave at boost-consulting.com
Tue May 27 02:16:06 CEST 2003
Jonathan Brandmeyer <jbrandmeyer at earthlink.net> 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
More information about the Cplusplus-sig
mailing list