[C++-sig] Boost.Python: wrapping a method returning const std::string &
Olaf Peter
ope-devel at gmx.de
Thu Aug 14 10:45:46 CEST 2008
Bilokon, Paul schrieb:
> Hi c++-sig,
>
> Sorry if this is supposed to be glaringly obvious, but I thought
> std::string types were pretty much fully supported in Boost.Python
> (looking at Boost 1.35.0).
>
> I'm trying to wrap a method
>
> const std::string& getName( ) const;
>
> This should be straightforward, right?
>
> I'm doing it like this:
>
> class_<Ccy>("Ccy", init<>())
> .def("getName", &Ccy::getName)
> ;
>
> But in return I'm getting
>
> Error 6 error C2027: use of undefined type
> 'boost::python::detail::specify_a_return_value_policy_to_wrap_functions_
> returning<T>'
> E:\dev\external\boost\boost_1_35_0\boost\python\detail\caller.hpp
> 223
>
> Is this because the string is returned by reference? Do I have to wrap
> the method? If so, I would be very much obliged if you could direct me
> to an example.
Cool compiler error, it says what he expected: see
http://www.boost.org/doc/libs/1_35_0/libs/python/doc/v2/copy_const_reference.html.
Please google, why this is you friend.
Regards,
Olaf
More information about the Cplusplus-sig
mailing list