On Sun, Mar 21, 2010 at 10:06 AM, Maciej Sitarz <macieksit...@wp.pl> wrote: > Yes, it works, because there's no code generated for std::vector<item_t> > Try adding this function to item_t class: > void fund( std::vector<item_t>& v) { } > > And then it doesn't compile successfully. > > When I comment this line from the generated code: > vector_less__item_t__greater__exposer.def( bp::indexing::vector_suite< > std::vector< item_t > >() ); > it compiles and appears to work, but I can't figure out how to pass a > list/vector to that function: > > > import test > item = test.item_t( 10 ) > vect = [test.item_t(1), test.item_t(2)] > item.fund(vect) > --------------------------------------------------------------------------- > ArgumentError Traceback (most recent call last) > > /home/macieks/error_examples/protected_assign/<ipython console> > > ArgumentError: Python argument types in > item_t.fund(item_t, list) > did not match C++ signature: > fund(item_t {lvalue}, std::vector<item_t, std::allocator<item_t> > > {lvalue} v) > > In [5]: vect > Out[5]: > [<test.item_t object at 0x7f8f38899e10>, > <test.item_t object at 0x7f8f38899d60>] > > In [6]: vect? > Type: list > Base Class: <type 'list'> > String Form: [<test.item_t object at 0x7f8f38899e10>, <test.item_t object > at 0x7f8f38899d60>] > Namespace: Interactive > Length: 2 > Docstring: > list() -> new list > list(sequence) -> new list initialized from sequence's items > > I'm not sure, but that should work, shouldn't it?
1. I would talk with developers to understand the reasons for such interface 2. create wrapper function, which takes regular python list and creates a vector from it and expose this function, instead of the original one -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig