]>
Commit | Line | Data |
---|---|---|
1 | /*============================================================================= | |
2 | Copyright (c) 2016 Lee Clagett | |
3 | ||
4 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | ==============================================================================*/ | |
7 | #ifndef FUSION_AND_07152016_1625 | |
8 | #define FUSION_AND_07152016_1625 | |
9 | ||
10 | #include <boost/config.hpp> | |
11 | #include <boost/type_traits/integral_constant.hpp> | |
12 | ||
13 | #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | |
14 | #error fusion::detail::and_ requires variadic templates | |
15 | #endif | |
16 | ||
17 | namespace boost { namespace fusion { namespace detail { | |
18 | template<typename ...Cond> | |
19 | struct and_impl : false_type {}; | |
20 | ||
21 | template<typename ...T> | |
22 | struct and_impl<integral_constant<T, true>...> : true_type {}; | |
23 | ||
24 | // This specialization is necessary to avoid MSVC-12 variadics bug. | |
25 | template<bool ...Cond> | |
26 | struct and_impl1 : and_impl<integral_constant<bool, Cond>...> {}; | |
27 | ||
28 | /* fusion::detail::and_ differs from mpl::and_ in the following ways: | |
29 | - The empty set is valid and returns true | |
30 | - A single element set is valid and returns the identity | |
31 | - There is no upper bound on the set size | |
32 | - The conditions are evaluated at once, and are not short-circuited. This | |
33 | reduces instantations when returning true; the implementation is not | |
34 | recursive. */ | |
35 | template<typename ...Cond> | |
36 | struct and_ : and_impl1<Cond::value...> {}; | |
37 | }}} | |
38 | ||
39 | #endif // FUSION_AND_07152016_1625 |