From 6ec791e3b95a305924da0f4e197d6424d152048a Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 8 Nov 2003 04:12:18 +0000 Subject: [PATCH] checkpoint [SVN r20733] --- include/boost/iterator/detail/config_def.hpp | 41 ++++++++++++++++++- .../boost/iterator/detail/config_undef.hpp | 1 + .../boost/iterator/iterator_categories.hpp | 12 +++--- include/boost/iterator/iterator_facade.hpp | 2 +- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/include/boost/iterator/detail/config_def.hpp b/include/boost/iterator/detail/config_def.hpp index 6789d4a..a2e7789 100644 --- a/include/boost/iterator/detail/config_def.hpp +++ b/include/boost/iterator/detail/config_def.hpp @@ -18,7 +18,46 @@ #include // for prior #include -#define BOOST_ITERATOR_CONFIG_DEF // if you get an error here, you have nested config_def #inclusion. +#ifdef BOOST_ITERATOR_CONFIG_DEF +# error you have nested config_def #inclusion. +#else +# define BOOST_ITERATOR_CONFIG_DEF +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) \ + || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) +# define BOOST_NO_LVALUE_RETURN_DETECTION + +# if 0 // test code + struct v {}; + + typedef char (&no)[3]; + + template + no foo(T const&, ...); + + template + char foo(T&, int); + + + struct value_iterator + { + v operator*() const; + }; + + template + struct lvalue_deref_helper + { + static T& x; + enum { value = (sizeof(foo(*x,0)) == 1) }; + }; + + int z2[(lvalue_deref_helper::value == 1) ? 1 : -1]; + int z[(lvalue_deref_helper::value) == 1 ? -1 : 1 ]; +# endif + +#endif #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ || BOOST_WORKAROUND(__GNUC__, <= 2 && __GNUC_MINOR__ <= 95) \ diff --git a/include/boost/iterator/detail/config_undef.hpp b/include/boost/iterator/detail/config_undef.hpp index f58df62..f93adae 100644 --- a/include/boost/iterator/detail/config_undef.hpp +++ b/include/boost/iterator/detail/config_undef.hpp @@ -18,6 +18,7 @@ #undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE #undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY #undef BOOST_ARG_DEPENDENT_TYPENAME +#undef BOOST_NO_LVALUE_RETURN_DETECTION #ifdef BOOST_ITERATOR_CONFIG_DEF # undef BOOST_ITERATOR_CONFIG_DEF diff --git a/include/boost/iterator/iterator_categories.hpp b/include/boost/iterator/iterator_categories.hpp index 6e14f79..eedeee0 100644 --- a/include/boost/iterator/iterator_categories.hpp +++ b/include/boost/iterator/iterator_categories.hpp @@ -302,7 +302,7 @@ namespace boost { // writability at the level of input iterator/output iterator. template <> struct iterator_tag_base< - readable_iterator|lvalue_iterator + access_c<(readable_iterator|lvalue_iterator)> , single_pass_traversal_tag > { @@ -378,7 +378,7 @@ namespace boost { >::type { typedef detail::access_c<(Access & ~lvalue_iterator)> access_type; - BOOST_STATIC_CONSTANT(iterator_access, access_type::value); + BOOST_STATIC_CONSTANT(iterator_access, value = (iterator_access)(Access & ~lvalue_iterator)); typedef TraversalTag traversal; }; @@ -389,8 +389,8 @@ namespace boost { struct is_boost_iterator_tag : mpl::false_ {}; - template - struct is_boost_iterator_tag > + template + struct is_boost_iterator_tag > : mpl::true_ {}; # else template @@ -399,8 +399,8 @@ namespace boost { typedef char (&yes)[1]; typedef char (&no)[2]; - template - static yes test(mpl::identity >*); + template + static yes test(mpl::identity >*); static no test(...); static mpl::identity* inst; diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 7f00495..192a00d 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -340,7 +340,7 @@ namespace boost template < class Derived // The derived iterator type being constructed , class Value - , class AccessCategory + , unsigned AccessCategory , class TraversalCategory , class Reference = Value& , class Difference = std::ptrdiff_t