Chris@102: // Boost enable_if library Chris@102: Chris@102: // Copyright 2003 (c) The Trustees of Indiana University. Chris@102: Chris@102: // Use, modification, and distribution is subject to the Boost Software Chris@102: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@102: // http://www.boost.org/LICENSE_1_0.txt) Chris@102: Chris@102: // Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) Chris@102: // Jeremiah Willcock (jewillco at osl.iu.edu) Chris@102: // Andrew Lumsdaine (lums at osl.iu.edu) Chris@102: Chris@102: Chris@102: #ifndef BOOST_CORE_ENABLE_IF_HPP Chris@102: #define BOOST_CORE_ENABLE_IF_HPP Chris@102: Chris@102: #include "boost/config.hpp" Chris@102: Chris@102: // Even the definition of enable_if causes problems on some compilers, Chris@102: // so it's macroed out for all compilers that do not support SFINAE Chris@102: Chris@102: #ifndef BOOST_NO_SFINAE Chris@102: Chris@102: namespace boost Chris@102: { Chris@102: Chris@102: template Chris@102: struct enable_if_c { Chris@102: typedef T type; Chris@102: }; Chris@102: Chris@102: template Chris@102: struct enable_if_c {}; Chris@102: Chris@102: template Chris@102: struct enable_if : public enable_if_c {}; Chris@102: Chris@102: template Chris@102: struct lazy_enable_if_c { Chris@102: typedef typename T::type type; Chris@102: }; Chris@102: Chris@102: template Chris@102: struct lazy_enable_if_c {}; Chris@102: Chris@102: template Chris@102: struct lazy_enable_if : public lazy_enable_if_c {}; Chris@102: Chris@102: Chris@102: template Chris@102: struct disable_if_c { Chris@102: typedef T type; Chris@102: }; Chris@102: Chris@102: template Chris@102: struct disable_if_c {}; Chris@102: Chris@102: template Chris@102: struct disable_if : public disable_if_c {}; Chris@102: Chris@102: template Chris@102: struct lazy_disable_if_c { Chris@102: typedef typename T::type type; Chris@102: }; Chris@102: Chris@102: template Chris@102: struct lazy_disable_if_c {}; Chris@102: Chris@102: template Chris@102: struct lazy_disable_if : public lazy_disable_if_c {}; Chris@102: Chris@102: } // namespace boost Chris@102: Chris@102: #else Chris@102: Chris@102: namespace boost { Chris@102: Chris@102: namespace detail { typedef void enable_if_default_T; } Chris@102: Chris@102: template Chris@102: struct enable_if_does_not_work_on_this_compiler; Chris@102: Chris@102: template Chris@102: struct enable_if_c : enable_if_does_not_work_on_this_compiler Chris@102: { }; Chris@102: Chris@102: template Chris@102: struct disable_if_c : enable_if_does_not_work_on_this_compiler Chris@102: { }; Chris@102: Chris@102: template Chris@102: struct lazy_enable_if_c : enable_if_does_not_work_on_this_compiler Chris@102: { }; Chris@102: Chris@102: template Chris@102: struct lazy_disable_if_c : enable_if_does_not_work_on_this_compiler Chris@102: { }; Chris@102: Chris@102: template Chris@102: struct enable_if : enable_if_does_not_work_on_this_compiler Chris@102: { }; Chris@102: Chris@102: template Chris@102: struct disable_if : enable_if_does_not_work_on_this_compiler Chris@102: { }; Chris@102: Chris@102: template Chris@102: struct lazy_enable_if : enable_if_does_not_work_on_this_compiler Chris@102: { }; Chris@102: Chris@102: template Chris@102: struct lazy_disable_if : enable_if_does_not_work_on_this_compiler Chris@102: { }; Chris@102: Chris@102: } // namespace boost Chris@102: Chris@102: #endif // BOOST_NO_SFINAE Chris@102: Chris@102: #endif