On May 9, 2013, at 12:42 , Alex Leach <beamesleach@gmail.com> wrote:
On Thu, 09 May 2013 07:41:49 +0100, Wichert Akkerman <wichert@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.
They don't though: you can't create a pointer to a const reference. Wichert.