Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:48

0001 #ifndef BOOST_METAPARSE_V1_CPP98_IMPL_NTH_OF_C_HPP
0002 #define BOOST_METAPARSE_V1_CPP98_IMPL_NTH_OF_C_HPP
0003 
0004 // Copyright Abel Sinkovics (abel@sinkovics.hu)  2013.
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #include <boost/metaparse/v1/cpp98/impl/nth_of_c_impl.hpp>
0010 #include <boost/metaparse/v1/error/index_out_of_range.hpp>
0011 #include <boost/metaparse/v1/fail.hpp>
0012 #include <boost/metaparse/limit_sequence_size.hpp>
0013 
0014 #include <boost/mpl/list.hpp>
0015 
0016 #include <boost/preprocessor/repetition/repeat.hpp>
0017 #include <boost/preprocessor/punctuation/comma_if.hpp>
0018 #include <boost/preprocessor/repetition/enum_params.hpp>
0019 #include <boost/preprocessor/cat.hpp>
0020 
0021 namespace boost
0022 {
0023   namespace metaparse
0024   {
0025     namespace v1
0026     {
0027       namespace impl
0028       {
0029         #ifdef BOOST_METAPARSE_NTH_OF_CASE
0030         #  error BOOST_METAPARSE_NTH_OF_CASE already defined
0031         #endif
0032         #define BOOST_METAPARSE_NTH_OF_CASE(z, n, unused) \
0033           template < \
0034             int K BOOST_PP_COMMA_IF(n) \
0035             BOOST_PP_ENUM_PARAMS(n, class P) \
0036           > \
0037           struct BOOST_PP_CAT(nth_of_c, n) : \
0038             boost::mpl::if_< \
0039               boost::mpl::bool_<(0 <= K && K < n)>, \
0040               nth_of_c_impl< \
0041                 K, \
0042                 boost::mpl::list<BOOST_PP_ENUM_PARAMS(n, P)> \
0043               >, \
0044               fail<error::index_out_of_range<0, n - 1, K> > \
0045             >::type \
0046           {};
0047         
0048         BOOST_PP_REPEAT(
0049           BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
0050           BOOST_METAPARSE_NTH_OF_CASE,
0051           ~
0052         )
0053         
0054         #undef BOOST_METAPARSE_NTH_OF_CASE
0055       }
0056     }
0057   }
0058 }
0059 
0060 #endif
0061