1 #ifndef BOOST_METAPARSE_V1_IMPL_AT_C_HPP
2 #define BOOST_METAPARSE_V1_IMPL_AT_C_HPP
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)
9 #include <boost/metaparse/config.hpp>
10 #include <boost/metaparse/v1/fwd/string.hpp>
12 #include <boost/mpl/char.hpp>
14 #include <boost/preprocessor/repetition/enum_params.hpp>
15 #include <boost/preprocessor/repetition/repeat.hpp>
25 template <class S, int N>
28 #ifdef BOOST_METAPARSE_VARIADIC_STRING
29 template <char C, char... Cs, int N>
30 struct at_c<string<C, Cs...>, N> : at_c<string<Cs...>, N - 1> {};
32 template <char C, char... Cs>
33 struct at_c<string<C, Cs...>, 0> : boost::mpl::char_<C> {};
35 #ifdef BOOST_METAPARSE_STRING_CASE
36 # error BOOST_METAPARSE_STRING_CASE is already defined
38 #define BOOST_METAPARSE_STRING_CASE(z, n, unused) \
40 BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C) \
45 BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, C) \
49 boost::mpl::char_<BOOST_PP_CAT(C, n)> \
53 BOOST_METAPARSE_LIMIT_STRING_SIZE,
54 BOOST_METAPARSE_STRING_CASE,
58 #undef BOOST_METAPARSE_STRING_CASE