From 081251bc8aa7aed5aabe2f491d3f510ab98acb04 Mon Sep 17 00:00:00 2001 From: Raoul Gough Date: Tue, 9 Sep 2003 18:27:28 +0000 Subject: [PATCH] Use an enumerated type for indexing styles [SVN r1514] --- .../python/suite/indexing/iterator_suite.hpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/boost/python/suite/indexing/iterator_suite.hpp b/include/boost/python/suite/indexing/iterator_suite.hpp index 146e3669..ed6bffbb 100755 --- a/include/boost/python/suite/indexing/iterator_suite.hpp +++ b/include/boost/python/suite/indexing/iterator_suite.hpp @@ -31,6 +31,12 @@ #include namespace indexing { + enum IndexStyle { + index_style_none // No random access (iteration only) + , index_style_nonlinear // Random access by key (no slicing) + , index_style_linear // Random access by integer index (allows slicing) + }; + ////////////////////////////////////////////////////////////////////////// // Indexing traits for containers based on iterator pairs ////////////////////////////////////////////////////////////////////////// @@ -49,10 +55,10 @@ namespace indexing { typedef typename std_traits::difference_type index_type; typedef value_type key_type; // find, count, ... - static bool const has_copyable_iter = false; - static bool const is_reversible = false; - static bool const has_random_access = false; - static bool const has_mutable_ref = is_mutable_ref::value; + static bool const has_copyable_iter = false; + static bool const is_reversible = false; + static bool const has_mutable_ref = is_mutable_ref::value; + static IndexStyle const index_style = index_style_none; }; template @@ -73,7 +79,7 @@ namespace indexing { struct random_access_iterator_traits : public bidirectional_iterator_traits { - static bool const has_random_access = true; + static IndexStyle const index_style = index_style_linear; }; namespace iterator_detail {