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_LAST_OF_HPP
0002 #define BOOST_METAPARSE_V1_CPP98_LAST_OF_HPP
0003 
0004 // Copyright Abel Sinkovics (abel@sinkovics.hu)  2009 - 2010.
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/nth_of_c.hpp>
0010 
0011 #include <boost/preprocessor/cat.hpp>
0012 #include <boost/preprocessor/punctuation/comma_if.hpp>
0013 #include <boost/preprocessor/repetition/enum_params.hpp>
0014 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
0015 #include <boost/preprocessor/repetition/enum.hpp>
0016 #include <boost/preprocessor/repetition/repeat.hpp>
0017 #include <boost/preprocessor/arithmetic/sub.hpp>
0018 #include <boost/preprocessor/tuple/eat.hpp>
0019 
0020 namespace boost
0021 {
0022   namespace metaparse
0023   {
0024     namespace v1
0025     {
0026       template <
0027         BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
0028           BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
0029           class P,
0030           boost::mpl::na
0031         )
0032       >
0033       struct last_of;
0034 
0035       #ifdef BOOST_METAPARSE_LAST_OF_N
0036       #  error BOOST_METAPARSE_LAST_OF_N already defined
0037       #endif
0038       #define BOOST_METAPARSE_LAST_OF_N(z, n, unused) \
0039         template <BOOST_PP_ENUM_PARAMS(n, class P)> \
0040         struct last_of< \
0041           BOOST_PP_ENUM_PARAMS(n, P) \
0042           BOOST_PP_COMMA_IF(n) \
0043           BOOST_PP_ENUM( \
0044             BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, n), \
0045             boost::mpl::na BOOST_PP_TUPLE_EAT(3), \
0046             ~ \
0047           ) \
0048         > : \
0049           impl::BOOST_PP_CAT(nth_of_c, n)< \
0050             n - 1 BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, P) \
0051           > \
0052         {};
0053       
0054       BOOST_PP_REPEAT(
0055         BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
0056         BOOST_METAPARSE_LAST_OF_N,
0057         ~
0058       )
0059       
0060       #undef BOOST_METAPARSE_LAST_OF_N
0061     }
0062   }
0063 }
0064 
0065 #endif
0066