one_of.hpp 1012 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef BOOST_METAPARSE_V1_IMPL_ONE_OF_HPP
  2. #define BOOST_METAPARSE_V1_IMPL_ONE_OF_HPP
  3. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #include <boost/metaparse/v1/error/none_of_the_expected_cases_found.hpp>
  8. #include <boost/metaparse/v1/fail.hpp>
  9. #include <boost/metaparse/v1/cpp98/impl/one_of_fwd_op.hpp>
  10. #include <boost/mpl/fold.hpp>
  11. namespace boost
  12. {
  13. namespace metaparse
  14. {
  15. namespace v1
  16. {
  17. namespace impl
  18. {
  19. template <class Parsers>
  20. struct one_of
  21. {
  22. typedef one_of type;
  23. template <class S, class Pos>
  24. struct apply :
  25. boost::mpl::fold<
  26. Parsers,
  27. fail<error::none_of_the_expected_cases_found>::apply<S, Pos>,
  28. one_of_fwd_op<S, Pos>
  29. >::type
  30. {};
  31. };
  32. }
  33. }
  34. }
  35. }
  36. #endif