File indexing completed on 2025-01-18 09:38:14
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_HOF_GUARD_AND_H
0009 #define BOOST_HOF_GUARD_AND_H
0010
0011 #include <type_traits>
0012 #include <boost/hof/detail/using.hpp>
0013 #include <boost/hof/detail/intrinsics.hpp>
0014
0015 namespace boost { namespace hof { namespace detail {
0016
0017 constexpr bool and_c()
0018 {
0019 return true;
0020 }
0021
0022 template<class... Ts>
0023 constexpr bool and_c(bool b, Ts... bs)
0024 {
0025 return b && and_c(bs...);
0026 }
0027
0028 #ifdef _MSC_VER
0029
0030 template<class... Ts>
0031 struct and_;
0032
0033 template<class T, class... Ts>
0034 struct and_<T, Ts...>
0035 : std::integral_constant<bool, (T::value && and_<Ts...>::value)>
0036 {};
0037
0038 template<>
0039 struct and_<>
0040 : std::true_type
0041 {};
0042
0043 #define BOOST_HOF_AND_UNPACK(Bs) (boost::hof::detail::and_c(Bs...))
0044 #else
0045 template<bool...> struct bool_seq {};
0046 template<class... Ts>
0047 BOOST_HOF_USING(and_, std::is_same<bool_seq<Ts::value...>, bool_seq<(Ts::value, true)...>>);
0048
0049 #define BOOST_HOF_AND_UNPACK(Bs) BOOST_HOF_IS_BASE_OF(boost::hof::detail::bool_seq<Bs...>, boost::hof::detail::bool_seq<(Bs || true)...>)
0050
0051 #endif
0052
0053 }}}
0054
0055 #endif