File indexing completed on 2025-01-18 09:40:48
0001 #ifndef BOOST_METAPARSE_V1_CPP11_ONE_OF_HPP
0002 #define BOOST_METAPARSE_V1_CPP11_ONE_OF_HPP
0003
0004
0005
0006
0007
0008
0009 #include <boost/metaparse/v1/is_error.hpp>
0010 #include <boost/metaparse/v1/fail.hpp>
0011 #include <boost/metaparse/v1/cpp11/impl/eval_later_result.hpp>
0012 #include <boost/metaparse/v1/error/none_of_the_expected_cases_found.hpp>
0013
0014 #include <boost/mpl/eval_if.hpp>
0015
0016 namespace boost
0017 {
0018 namespace metaparse
0019 {
0020 namespace v1
0021 {
0022 template <class... Ps>
0023 struct one_of;
0024
0025 template <class P, class... Ps>
0026 struct one_of<P, Ps...>
0027 {
0028 typedef one_of type;
0029
0030 template <class S, class Pos>
0031 struct apply :
0032 boost::mpl::eval_if<
0033 typename is_error<typename P::template apply<S, Pos>>::type,
0034 boost::mpl::eval_if<
0035 typename is_error<
0036 typename one_of<Ps...>::template apply<S, Pos>
0037 >::type,
0038 impl::eval_later_result<
0039 typename P::template apply<S, Pos>,
0040 typename one_of<Ps...>::template apply<S, Pos>
0041 >,
0042 typename one_of<Ps...>::template apply<S, Pos>
0043 >,
0044 typename P::template apply<S, Pos>
0045 >
0046 {};
0047 };
0048
0049 template <>
0050 struct one_of<> : fail<error::none_of_the_expected_cases_found> {};
0051 }
0052 }
0053 }
0054
0055 #endif
0056