1 // (C) Copyright David Abrahams 2002.
\r
2 // (C) Copyright Jeremy Siek 2002.
\r
3 // (C) Copyright Thomas Witt 2002.
\r
4 // Distributed under the Boost Software License, Version 1.0. (See
\r
5 // accompanying file LICENSE_1_0.txt or copy at
\r
6 // http://www.boost.org/LICENSE_1_0.txt)
\r
7 #ifndef BOOST_ENABLE_IF_23022003THW_HPP
\r
8 #define BOOST_ENABLE_IF_23022003THW_HPP
\r
10 #include <boost/detail/workaround.hpp>
\r
11 #include <boost/mpl/identity.hpp>
\r
13 #include <boost/iterator/detail/config_def.hpp>
\r
16 // Boost iterators uses its own enable_if cause we need
\r
17 // special semantics for deficient compilers.
\r
27 // Base machinery for all kinds of enable if
\r
32 template<typename T>
\r
40 // For compilers that don't support "Substitution Failure Is Not An Error"
\r
41 // enable_if falls back to always enabled. See comments
\r
42 // on operator implementation for consequences.
\r
45 struct enabled<false>
\r
47 template<typename T>
\r
50 #ifdef BOOST_NO_SFINAE
\r
54 // This way to do it would give a nice error message containing
\r
55 // invalid overload, but has the big disadvantage that
\r
56 // there is no reference to user code in the error message.
\r
58 // struct invalid_overload;
\r
59 // typedef invalid_overload type;
\r
66 template <class Cond,
\r
69 # if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE)
\r
70 : enabled<(Cond::value)>::template base<Return>
\r
72 : mpl::identity<Return>
\r
75 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
\r
76 typedef Return type;
\r
80 } // namespace iterators
\r
82 } // namespace boost
\r
84 #include <boost/iterator/detail/config_undef.hpp>
\r
86 #endif // BOOST_ENABLE_IF_23022003THW_HPP
\r