Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:43

0001 /*=============================================================================
0002     Copyright (c) 2016 Lee Clagett
0003     Copyright (c) 2018 Kohei Takahashi
0004 
0005     Distributed under the Boost Software License, Version 1.0. (See accompanying
0006     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 ==============================================================================*/
0008 #ifndef FUSION_AND_07152016_1625
0009 #define FUSION_AND_07152016_1625
0010 
0011 #include <boost/config.hpp>
0012 #include <boost/config/workaround.hpp>
0013 #include <boost/type_traits/integral_constant.hpp>
0014 
0015 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
0016 #error fusion::detail::and_ requires variadic templates
0017 #endif
0018 
0019 namespace boost { namespace fusion { namespace detail {
0020 #if defined(BOOST_NO_CXX17_FOLD_EXPRESSIONS) \
0021  || BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1913))
0022     template<typename ...Cond>
0023     struct and_impl : false_type {};
0024 
0025     template<typename ...T>
0026     struct and_impl<integral_constant<T, true>...> : true_type {};
0027 
0028     // This specialization is necessary to avoid MSVC-12 variadics bug.
0029     template<bool ...Cond>
0030     struct and_impl1 : and_impl<integral_constant<bool, Cond>...> {};
0031 
0032     /* fusion::detail::and_ differs from mpl::and_ in the following ways:
0033        - The empty set is valid and returns true
0034        - A single element set is valid and returns the identity
0035        - There is no upper bound on the set size
0036        - The conditions are evaluated at once, and are not short-circuited. This
0037          reduces instantations when returning true; the implementation is not
0038          recursive. */
0039     template<typename ...Cond>
0040     struct and_ : and_impl1<Cond::value...> {};
0041 #else
0042     template <typename ...Cond>
0043     struct and_ : integral_constant<bool, ((bool)Cond::value && ...)> {};
0044 #endif
0045 }}}
0046 
0047 #endif // FUSION_AND_07152016_1625