> One could imagine writing a fancy converter that would allow the first 
> form by making a temporary std::vector, passing that to the C++ 
> function, and then copying the elements in the vector back into the 
> Python list.  But that's potentially a very expensive sequence of 
> operations, and it's actually impossible to do that through a registered 
> converter in Boost.Python.

In some cases, such a converter makes sense, I wrote one (see 
http://bazaar.launchpad.net/~eudoxos/+junk/tr2/view/head:/py/wrapper/customConverters.cpp#L142,
then its specializations for various types below). Where
std::vector<containedType> arg is expected, it will check whether the python
object is a sequence and then convert is to the c++ vector. Of course the
objects are being copied, not referenced, unless those objects are shared_ptr's,
in which case you get reference semantics you asked for.

Cheers, vaclav


_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to