From 2bca71488b7768fb525ffb6b722e802baf4d0902 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Fri, 8 Nov 2002 17:08:17 +0000 Subject: [PATCH] Works with MSVC and Intel5 now. Thanks, Aleksey!! [SVN r16165] --- include/boost/detail/iterator.hpp | 52 ++++++++++++++----------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/include/boost/detail/iterator.hpp b/include/boost/detail/iterator.hpp index 83e138a..fdc0d75 100644 --- a/include/boost/detail/iterator.hpp +++ b/include/boost/detail/iterator.hpp @@ -58,9 +58,11 @@ # include # include # include +# include # include # include + // should be the last #include #include "boost/type_traits/detail/bool_trait_def.hpp" @@ -83,6 +85,12 @@ namespace boost { namespace detail { +BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type) +BOOST_MPL_HAS_XXX_TRAIT_DEF(reference) +BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer) +BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type) +BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category) + # if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) using std::iterator_traits; using std::distance; @@ -125,23 +133,16 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1( // A metafunction returning true iff T has all the requisite nested // types to satisfy the requirements for a fully-conforming // iterator_traits implementation. -template -type_traits::yes_type is_full_iterator_traits_helper( - T const volatile* - , BOOST_DEDUCED_TYPENAME T::value_type* = 0 - , BOOST_DEDUCED_TYPENAME T::reference (*)() = 0 - , BOOST_DEDUCED_TYPENAME T::pointer* = 0 - , BOOST_DEDUCED_TYPENAME T::difference_type* = 0 - , BOOST_DEDUCED_TYPENAME T::iterator_category* = 0 - ); - -type_traits::no_type is_full_iterator_traits_helper(...); - template struct is_full_iterator_traits_impl { - enum { value = sizeof( - is_full_iterator_traits_helper((T*)0)) == sizeof(type_traits::yes_type) }; + enum { value = + has_value_type::value + & has_reference::value + & has_pointer::value + & has_difference_type::value + & has_iterator_category::value + }; }; BOOST_TT_AUX_BOOL_TRAIT_DEF1( @@ -149,28 +150,23 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1( # ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF +BOOST_MPL_HAS_XXX_TRAIT_DEF(_Iterator_category) + // is_stlport_40_debug_iterator -- // // A metafunction returning true iff T has all the requisite nested // types to satisfy the requirements of an STLPort 4.0 debug iterator // iterator_traits implementation. -template -type_traits::yes_type is_stlport_40_debug_iterator_helper( - T const volatile* - , BOOST_DEDUCED_TYPENAME T::value_type* = 0 - , BOOST_DEDUCED_TYPENAME T::reference (*)() = 0 - , BOOST_DEDUCED_TYPENAME T::pointer* = 0 - , BOOST_DEDUCED_TYPENAME T::difference_type* = 0 - , BOOST_DEDUCED_TYPENAME T::_Iterator_category* = 0 - ); - -type_traits::no_type is_stlport_40_debug_iterator_helper(...); - template struct is_stlport_40_debug_iterator_impl { - enum { value = sizeof( - is_stlport_40_debug_iterator_helper((T*)0)) == sizeof(type_traits::yes_type) }; + enum { value = + has_value_type::value + & has_reference::value + & has_pointer::value + & has_difference_type::value + & has__Iterator_category::value + }; }; BOOST_TT_AUX_BOOL_TRAIT_DEF1(