#ifndef BOOST_METAPARSE_V1_IMPL_SPLIT_AT_C_HPP #define BOOST_METAPARSE_V1_IMPL_SPLIT_AT_C_HPP // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include #include #include #include #include namespace boost { namespace metaparse { namespace v1 { namespace impl { template struct split_at_c; #ifdef BOOST_METAPARSE_VARIADIC_STRING template struct split_at_c> : boost::mpl::pair< typename push_front_c< typename split_at_c>::type::first, C >::type, typename split_at_c>::type::second > {}; template struct split_at_c<0, string> : boost::mpl::pair, string> {}; template struct split_at_c<0, S> : boost::mpl::pair, S> {}; #else #ifdef BOOST_METAPARSE_ARG # error BOOST_METAPARSE_ARG already defined #endif #define BOOST_METAPARSE_ARG(z, n, d) BOOST_PP_CAT(C, BOOST_PP_ADD(n, d)) #ifdef BOOST_METAPARSE_SPLIT_AT # error BOOST_METAPARSE_SPLIT_AT already defined #endif #define BOOST_METAPARSE_SPLIT_AT(z, n, unused) \ template < \ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_STRING_SIZE, int C) \ > \ struct \ split_at_c< \ n, \ string \ > : \ boost::mpl::pair< \ string, \ string< \ BOOST_PP_ENUM( \ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_STRING_SIZE, n), \ BOOST_METAPARSE_ARG, \ n \ ) \ > \ > \ {}; BOOST_PP_REPEAT( BOOST_METAPARSE_LIMIT_STRING_SIZE, BOOST_METAPARSE_SPLIT_AT, ~ ) #undef BOOST_METAPARSE_SPLIT_AT #undef BOOST_METAPARSE_ARG #endif } } } } #endif