[C++-sig] Re: Automatic (implicit ?) type conversion for a data member of a struct.

David Abrahams dave at boost-consulting.com
Mon May 26 22:07:32 CEST 2003


Gavin Doughtie <gdoughtie at anim.dreamworks.com> writes:

> 	// THIS FAILS MISERABLY
>      lvalue_from_pytype<CStringExtractor, &PyString_Type>();

It's no wonder; a Python string object doesn't contain an instance of
a CString, so anythin which tries to get a CString lvalue out of it
is bound to reference invalid memory.

You need an rvalue from_python converter.  You can find out more
about those here:

    http://www.boost.org/libs/python/doc/v2/faq.html#question2

HTH,
-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list