On Thu, Jul 23, 2009 at 6:59 PM, Matthew Scouten
(TT)<[email protected]> wrote:
> This is a sketch of what I want to do. This seems to work seamlessly
> with the
> included indexing suite. I cannot figure out how the make it work with
> the advanced one.
Okey. By default the indexing suite v2 returns objects by value (
default call policy ).
It is very simple to change this behavior:
namespace bp = boost::python;
typedef bp::class_< std::vector< foo > > foo_vector_exposer_t;
foo_vector_exposer_t foo_vector_exposer =
foo_vector_exposer_t( "foo_vector");
bp::scope foo_vector_scope( foo_vector_exposer );
foo_vector_exposer.def( bp::indexing::vector_suite<
std::vector< foo > >::with_policies(bp::return_internal_reference<
>()) );
And than all your code will work as expected.
I suggest you not to use "container_suite":
* the compilation is longer
* it is also unable to guess/resolve between map and multimap containers.
P.S. Let me know if you still want\need to use container_proxy. I
never used that class, so it could take me some time to understand it.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
_______________________________________________
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig