[C++-sig] Type converter not found for property

Alex Leach beamesleach at gmail.com
Thu May 9 12:42:57 CEST 2013


On Thu, 09 May 2013 07:41:49 +0100, Wichert Akkerman <wichert at wiggy.net>  
wrote:

> If I try to do that by adding this:
>
>   to_python_converter<boost::uuids::uuid, uuid_to_python>();
>   to_python_converter<boost::uuids::uuid&, uuid_to_python>()
>
> I get a compile error:
>
> /opt/local/include/boost/python/converter/as_to_python_function.hpp:21:84:  
> error: 'type name' declared as a pointer to a reference of type  
> 'boost::uuids::uuid &'
>     static void  
> convert_function_must_take_value_or_const_reference(U(*)(T), int, T* =  
> 0) {}
>                                                                                    ^
> /opt/local/include/boost/python/to_python_converter.hpp:88:10: note: in  
> instantiation of template class  
> 'boost::python::converter::as_to_python_function<boost::uuids::uuid &,
>       <anonymous>::uuid_to_python>' requested here
>         &normalized::convert
>          ^
> ../../python/uuid.cc:77:2: note: in instantiation of member function  
> 'boost::python::to_python_converter<boost::uuids::uuid &,  
> <anonymous>::uuid_to_python, false>::to_python_converter' requested
>       here
>         python::to_python_converter<boost::uuids::uuid&,  
> uuid_to_python>();
>
> which suggests that to_python_converter doesn't really like to see  
> references.
>

Unfortunately the convert function doesn't like non-const references;  
const references (and values) should work fine, though.

Cheers,
Alex


More information about the Cplusplus-sig mailing list