[C++-sig] Boost.Python: wrapping a method returning const std::string &

Bilokon, Paul paul.bilokon at lehman.com
Thu Aug 14 10:24:50 CEST 2008


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.

Many thanks,
Paul
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.




More information about the Cplusplus-sig mailing list