Disable interop properly for vc6/7 using known SFINAE capabilities.

[SVN r24209]
This commit is contained in:
Dave Abrahams
2004-07-31 18:10:00 +00:00
parent 1a9677d9dc
commit dd72d599c8
4 changed files with 40 additions and 6 deletions

View File

@@ -112,7 +112,7 @@
# define BOOST_ITERATOR_NO_MPL_AUX_HAS_XXX // "MPL's has_xxx facility doesn't work" # define BOOST_ITERATOR_NO_MPL_AUX_HAS_XXX // "MPL's has_xxx facility doesn't work"
#endif #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 # define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
#endif #endif

View File

@@ -102,7 +102,22 @@ namespace boost
// false positives for user/library defined iterator types. See comments // false positives for user/library defined iterator types. See comments
// on operator implementation for consequences. // on operator implementation for consequences.
// //
# if defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE) # if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
template<typename From, typename To>
struct enable_if_convertible
{
typedef typename mpl::if_<
mpl::or_<
is_same<From,To>
, is_convertible<From, To>
>
, detail::enable_type
, int&
>::type type;
};
# elif defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE)
template <class From, class To> template <class From, class To>
struct enable_if_convertible struct enable_if_convertible

View File

@@ -66,6 +66,18 @@ namespace boost
, class Return , class Return
> >
struct enable_if_interoperable struct enable_if_interoperable
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
{
typedef typename mpl::if_<
mpl::or_<
is_convertible<Facade1, Facade2>
, is_convertible<Facade2, Facade1>
>
, Return
, int[3]
>::type type;
};
#else
: ::boost::iterators::enable_if< : ::boost::iterators::enable_if<
mpl::or_< mpl::or_<
is_convertible<Facade1, Facade2> is_convertible<Facade1, Facade2>
@@ -73,8 +85,8 @@ namespace boost
> >
, Return , Return
> >
{ {};
}; #endif
// //
// Generates associated types for an iterator_facade with the // Generates associated types for an iterator_facade with the

View File

@@ -124,7 +124,7 @@ namespace boost
transform_iterator( transform_iterator(
transform_iterator<OtherUnaryFunction, OtherIterator, OtherReference, OtherValue> const& t transform_iterator<OtherUnaryFunction, OtherIterator, OtherReference, OtherValue> const& t
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1310) #if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
, typename enable_if_convertible<OtherUnaryFunction, UnaryFunction>::type* = 0 , typename enable_if_convertible<OtherUnaryFunction, UnaryFunction>::type* = 0
#endif #endif
) )
@@ -158,9 +158,16 @@ namespace boost
// function pointer in the iterator be 0, leading to a runtime // function pointer in the iterator be 0, leading to a runtime
// crash. // crash.
template <class UnaryFunction, class Iterator> template <class UnaryFunction, class Iterator>
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
typename mpl::if_<
#else
typename iterators::enable_if< typename iterators::enable_if<
#endif
is_class<UnaryFunction> // We should probably find a cheaper test than is_class<> is_class<UnaryFunction> // We should probably find a cheaper test than is_class<>
, transform_iterator<UnaryFunction, Iterator> , transform_iterator<UnaryFunction, Iterator>
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
, int[3]
#endif
>::type >::type
make_transform_iterator(Iterator it) make_transform_iterator(Iterator it)
{ {