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