Chris@16: // (C) Copyright David Abrahams 2002. Chris@16: // (C) Copyright Jeremy Siek 2002. Chris@16: // (C) Copyright Thomas Witt 2002. Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: #ifndef BOOST_ENABLE_IF_23022003THW_HPP Chris@16: #define BOOST_ENABLE_IF_23022003THW_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: // Chris@16: // Boost iterators uses its own enable_if cause we need Chris@16: // special semantics for deficient compilers. Chris@16: // 23/02/03 thw Chris@16: // Chris@16: Chris@16: namespace boost Chris@16: { Chris@16: Chris@16: namespace iterators Chris@16: { Chris@16: // Chris@16: // Base machinery for all kinds of enable if Chris@16: // Chris@16: template Chris@16: struct enabled Chris@16: { Chris@16: template Chris@16: struct base Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: }; Chris@101: Chris@16: // Chris@16: // For compilers that don't support "Substitution Failure Is Not An Error" Chris@16: // enable_if falls back to always enabled. See comments Chris@16: // on operator implementation for consequences. Chris@16: // Chris@16: template<> Chris@16: struct enabled Chris@16: { Chris@16: template Chris@16: struct base Chris@16: { Chris@16: #ifdef BOOST_NO_SFINAE Chris@16: Chris@16: typedef T type; Chris@16: Chris@16: // This way to do it would give a nice error message containing Chris@16: // invalid overload, but has the big disadvantage that Chris@16: // there is no reference to user code in the error message. Chris@16: // Chris@16: // struct invalid_overload; Chris@16: // typedef invalid_overload type; Chris@16: // Chris@16: #endif Chris@16: }; Chris@16: }; Chris@16: Chris@16: Chris@16: template Chris@16: struct enable_if Chris@16: # if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE) Chris@16: : enabled<(Cond::value)>::template base Chris@16: # else Chris@16: : mpl::identity Chris@101: # endif Chris@16: { Chris@16: }; Chris@16: Chris@16: } // namespace iterators Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // BOOST_ENABLE_IF_23022003THW_HPP