From dd72d599c8be840ba9e16f2412284b7170e64412 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 31 Jul 2004 18:10:00 +0000 Subject: [PATCH] Disable interop properly for vc6/7 using known SFINAE capabilities. [SVN r24209] --- include/boost/iterator/detail/config_def.hpp | 2 +- include/boost/iterator/iterator_adaptor.hpp | 17 ++++++++++++++++- include/boost/iterator/iterator_facade.hpp | 18 +++++++++++++++--- include/boost/iterator/transform_iterator.hpp | 9 ++++++++- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/include/boost/iterator/detail/config_def.hpp b/include/boost/iterator/detail/config_def.hpp index 0f6ba5b..08658af 100644 --- a/include/boost/iterator/detail/config_def.hpp +++ b/include/boost/iterator/detail/config_def.hpp @@ -112,7 +112,7 @@ # define BOOST_ITERATOR_NO_MPL_AUX_HAS_XXX // "MPL's has_xxx facility doesn't work" #endif -#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE) +#if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) # define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY #endif diff --git a/include/boost/iterator/iterator_adaptor.hpp b/include/boost/iterator/iterator_adaptor.hpp index 0778fce..00bd6dc 100644 --- a/include/boost/iterator/iterator_adaptor.hpp +++ b/include/boost/iterator/iterator_adaptor.hpp @@ -102,7 +102,22 @@ namespace boost // false positives for user/library defined iterator types. See comments // on operator implementation for consequences. // -# if defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE) +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + + template + struct enable_if_convertible + { + typedef typename mpl::if_< + mpl::or_< + is_same + , is_convertible + > + , detail::enable_type + , int& + >::type type; + }; + +# elif defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE) template struct enable_if_convertible diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 251a5c8..0f16439 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -56,7 +56,7 @@ namespace boost typedef bool type; }; }; - + // // enable if for use in operator implementation. // @@ -66,6 +66,18 @@ namespace boost , class Return > struct enable_if_interoperable +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + { + typedef typename mpl::if_< + mpl::or_< + is_convertible + , is_convertible + > + , Return + , int[3] + >::type type; + }; +#else : ::boost::iterators::enable_if< mpl::or_< is_convertible @@ -73,8 +85,8 @@ namespace boost > , Return > - { - }; + {}; +#endif // // Generates associated types for an iterator_facade with the diff --git a/include/boost/iterator/transform_iterator.hpp b/include/boost/iterator/transform_iterator.hpp index 20da1ab..c77c4a8 100644 --- a/include/boost/iterator/transform_iterator.hpp +++ b/include/boost/iterator/transform_iterator.hpp @@ -124,7 +124,7 @@ namespace boost transform_iterator( transform_iterator const& t , typename enable_if_convertible::type* = 0 -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1310) +#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310) , typename enable_if_convertible::type* = 0 #endif ) @@ -158,9 +158,16 @@ namespace boost // function pointer in the iterator be 0, leading to a runtime // crash. template +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + typename mpl::if_< +#else typename iterators::enable_if< +#endif is_class // We should probably find a cheaper test than is_class<> , transform_iterator +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + , int[3] +#endif >::type make_transform_iterator(Iterator it) {