From 980733a96d36e64c554493b112d786f5d55bd03a Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Thu, 7 Jul 2005 14:00:31 +0000 Subject: [PATCH] fixed bug where a vector is being wrapped by the indexing suite. [SVN r29930] --- .../indexing/detail/indexing_suite_detail.hpp | 21 +++++++- test/Jamfile | 2 + test/Jamfile.v2 | 1 + test/pointer_vector.cpp | 48 +++++++++++++++++++ test/pointer_vector.py | 31 ++++++++++++ 5 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 test/pointer_vector.cpp create mode 100644 test/pointer_vector.py diff --git a/include/boost/python/suite/indexing/detail/indexing_suite_detail.hpp b/include/boost/python/suite/indexing/detail/indexing_suite_detail.hpp index 34a4096a..bf4fe91c 100644 --- a/include/boost/python/suite/indexing/detail/indexing_suite_detail.hpp +++ b/include/boost/python/suite/indexing/detail/indexing_suite_detail.hpp @@ -11,6 +11,7 @@ # include # include # include +# include # include # include #include @@ -462,13 +463,29 @@ namespace boost { namespace python { namespace detail { { } + template + static object + base_get_item_helper(DataType const& p, mpl::true_) + { + return object(ptr(p)); + } + + template + static object + base_get_item_helper(DataType const& x, mpl::false_) + { + return object(x); + } + static object base_get_item_(back_reference const& container, PyObject* i) { - return object( + return base_get_item_helper( DerivedPolicies::get_item( container.get(), DerivedPolicies:: - convert_index(container.get(), i))); + convert_index(container.get(), i)) + , is_pointer() + ); } static void diff --git a/test/Jamfile b/test/Jamfile index be5edac1..e993bf51 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -162,6 +162,8 @@ bpl-test crossmod_exception [ bpl-test docstring ] [ bpl-test vector_indexing_suite ] +[ bpl-test pointer_vector ] + [ extension map_indexing_suite_ext : map_indexing_suite.cpp int_map_indexing_suite.cpp