From 2c8f1fb5d3b4ee7e94d7b1e7303edb42dd3cdcf5 Mon Sep 17 00:00:00 2001 From: Raoul Gough Date: Sun, 8 Feb 2004 19:04:39 +0000 Subject: [PATCH] Use bitwise combination of numeric method IDs to decide what to support [SVN r22197] --- test/test_indexing_const.cpp | 6 ------ test/test_vector_disable.cpp | 18 +++++++++++++----- test/test_vector_shared.cpp | 6 ++++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/test/test_indexing_const.cpp b/test/test_indexing_const.cpp index abeacd8c..1f80eb41 100755 --- a/test/test_indexing_const.cpp +++ b/test/test_indexing_const.cpp @@ -17,7 +17,6 @@ #include "int_wrapper.hpp" #include -#include // for begin(), end() #include #include #include @@ -37,12 +36,7 @@ std::vector get_vector () int_wrapper(7), int_wrapper(0) }; return std::vector -#if BOOST_WORKAROUND (BOOST_MSVC, <=1200) (array, array + sizeof(array) / sizeof (array[0])); -#else - (boost::python::indexing::begin(array), - boost::python::indexing::end(array)); -#endif } BOOST_PYTHON_MODULE(test_indexing_const_ext) diff --git a/test/test_vector_disable.cpp b/test/test_vector_disable.cpp index b2b359db..ffc98c41 100755 --- a/test/test_vector_disable.cpp +++ b/test/test_vector_disable.cpp @@ -1,11 +1,14 @@ -// Module test_vector_disable.cpp -// // Copyright (c) 2003 Raoul M. Gough // // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy // at http://www.boost.org/LICENSE_1_0.txt) // +// Module test_vector_disable.cpp +// +// Expose a vector with minimal supported methods. Should produce a +// much smaller object file that otherwise. +// // History // ======= // 2003/11/19 rmg File creation @@ -26,15 +29,20 @@ BOOST_PYTHON_MODULE(test_vector_disable_ext) typedef std::vector Container1; - // Generate a vector suite with all optional support disabled + // Binary mask for the four methods we want to support + unsigned int const mask + = indexing::method_getitem + | indexing::method_setitem + | indexing::method_delitem + | indexing::method_append; #if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) // Normal case (automatic algorithm and traits selection) - typedef indexing::container_suite + typedef indexing::container_suite Suite1; #else // For broken compilers - explicit selection of algorithms/traits - typedef indexing::vector_suite + typedef indexing::vector_suite Suite1; #endif diff --git a/test/test_vector_shared.cpp b/test/test_vector_shared.cpp index 394fba83..2e093214 100755 --- a/test/test_vector_shared.cpp +++ b/test/test_vector_shared.cpp @@ -56,10 +56,12 @@ BOOST_PYTHON_MODULE(test_vector_shared_ext) #else // Otherwise do it the hard way typedef indexing::indirect_value_traits value_traits_; - typedef indexing::default_sequence_traits + typedef indexing::random_access_sequence_traits container_traits_; typedef indexing::default_algorithms algorithms_; - typedef indexing::container_suite Suite1; + + typedef indexing::container_suite< + Container1, indexing::all_methods, algorithms_> Suite1; #endif boost::python::class_("Vector_shared")