]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_METAPARSE_V1_IMPL_IS_ANY_HPP |
2 | #define BOOST_METAPARSE_V1_IMPL_IS_ANY_HPP | |
3 | ||
4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. | |
5 | // Distributed under the Boost Software License, Version 1.0. | |
6 | // (See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | #include <boost/metaparse/limit_one_char_except_size.hpp> | |
10 | ||
11 | #include <boost/mpl/eval_if.hpp> | |
12 | #include <boost/mpl/bool.hpp> | |
13 | ||
14 | #include <boost/preprocessor/cat.hpp> | |
15 | #include <boost/preprocessor/arithmetic/dec.hpp> | |
16 | #include <boost/preprocessor/repetition/enum_params.hpp> | |
17 | #include <boost/preprocessor/repetition/repeat_from_to.hpp> | |
18 | ||
19 | namespace boost | |
20 | { | |
21 | namespace metaparse | |
22 | { | |
23 | namespace v1 | |
24 | { | |
25 | namespace impl | |
26 | { | |
27 | template <class Stub = int> | |
28 | struct is_any0 | |
29 | { | |
30 | template <class C> | |
31 | struct apply : boost::mpl::true_ {}; | |
32 | }; | |
33 | ||
34 | #ifdef BOOST_METAPARSE_DEFINE_IS_ANY | |
35 | # error BOOST_METAPARSE_DEFINE_IS_ANY already defined | |
36 | #endif | |
37 | #define BOOST_METAPARSE_DEFINE_IS_ANY(z, n, unused) \ | |
38 | template <BOOST_PP_ENUM_PARAMS(n, class T)> \ | |
39 | struct BOOST_PP_CAT(is_any, n) \ | |
40 | { \ | |
41 | template <class C> \ | |
42 | struct apply : \ | |
43 | boost::mpl::eval_if< \ | |
44 | boost::mpl::bool_< \ | |
45 | C::type::value \ | |
46 | == BOOST_PP_CAT(T, BOOST_PP_DEC(n))::type::value \ | |
47 | >, \ | |
48 | boost::mpl::false_, \ | |
49 | typename BOOST_PP_CAT(is_any, BOOST_PP_DEC(n))< \ | |
50 | BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(n), T) \ | |
51 | >::template apply<C> \ | |
52 | > \ | |
53 | {}; \ | |
54 | }; | |
55 | ||
56 | BOOST_PP_REPEAT_FROM_TO( | |
57 | 1, | |
58 | BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE, | |
59 | BOOST_METAPARSE_DEFINE_IS_ANY, | |
60 | ~ | |
61 | ) | |
62 | ||
63 | #undef BOOST_METAPARSE_DEFINE_IS_ANY | |
64 | } | |
65 | } | |
66 | } | |
67 | } | |
68 | ||
69 | #endif | |
70 |