]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/metaparse/v1/cpp98/impl/nth_of_c.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / metaparse / v1 / cpp98 / impl / nth_of_c.hpp
1 #ifndef BOOST_METAPARSE_V1_CPP98_IMPL_NTH_OF_C_HPP
2 #define BOOST_METAPARSE_V1_CPP98_IMPL_NTH_OF_C_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/v1/cpp98/impl/nth_of_c_impl.hpp>
10 #include <boost/metaparse/v1/error/index_out_of_range.hpp>
11 #include <boost/metaparse/v1/fail.hpp>
12 #include <boost/metaparse/limit_sequence_size.hpp>
13
14 #include <boost/mpl/list.hpp>
15
16 #include <boost/preprocessor/repetition/repeat.hpp>
17 #include <boost/preprocessor/punctuation/comma_if.hpp>
18 #include <boost/preprocessor/repetition/enum_params.hpp>
19 #include <boost/preprocessor/cat.hpp>
20
21 namespace boost
22 {
23 namespace metaparse
24 {
25 namespace v1
26 {
27 namespace impl
28 {
29 #ifdef BOOST_METAPARSE_NTH_OF_CASE
30 # error BOOST_METAPARSE_NTH_OF_CASE already defined
31 #endif
32 #define BOOST_METAPARSE_NTH_OF_CASE(z, n, unused) \
33 template < \
34 int K BOOST_PP_COMMA_IF(n) \
35 BOOST_PP_ENUM_PARAMS(n, class P) \
36 > \
37 struct BOOST_PP_CAT(nth_of_c, n) : \
38 boost::mpl::if_< \
39 boost::mpl::bool_<(0 <= K && K < n)>, \
40 nth_of_c_impl< \
41 K, \
42 boost::mpl::list<BOOST_PP_ENUM_PARAMS(n, P)> \
43 >, \
44 fail<error::index_out_of_range<0, n - 1, K> > \
45 >::type \
46 {};
47
48 BOOST_PP_REPEAT(
49 BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
50 BOOST_METAPARSE_NTH_OF_CASE,
51 ~
52 )
53
54 #undef BOOST_METAPARSE_NTH_OF_CASE
55 }
56 }
57 }
58 }
59
60 #endif
61