[C++-sig] to_python converter and make_getter

Michael Wild themiwi at users.sourceforge.net
Wed Jan 23 19:08:32 CET 2013


On 01/23/2013 07:03 PM, Jim Bosch wrote:
> On 01/23/2013 12:56 PM, Michael Wild wrote:
> 
> <snip>
> 
>>
>> Yes, I thought of that too. While this "solves" this case (it certainly
>> is not very discoverable for future maintainers), it does not help in
>> the case of container support. Say I wanted to expose
>> std::vector<QString> (or std::vector<ustom_string> from the Boost.Python
>> FAQ, for that matter) using the boost::python::vector_indexing_suite. I
>> am perfectly able to create such a list, I can append items, the only
>> thing I can't do is *retrieving* them. It's like a black hole for data
>> ;-)
>>
> 
> I'm afraid the vector_indexing_suite is some black magic I'm not
> terribly familiar with.  But I do know that in some contexts it returns
> proxy objects in order to allow setting and safer lifetime management,
> and I suspect that's what is not playing nicely with your custom
> converters.  Or have you investigated that further and determined that
> it's calling make_getter, and that's why you're focused on that?

Not at all, I just stumbled across this problem a little later than the
one with the make_getter. Somehow I suspect that if I can teach bp to
properly return by value, both cases would be resolved automagically.
After all, things work smoothly for std::string.

Michael


More information about the Cplusplus-sig mailing list