one_of_fwd_op.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef BOOST_METAPARSE_V1_IMPL_ONE_OF_FWD_OP_HPP
  2. #define BOOST_METAPARSE_V1_IMPL_ONE_OF_FWD_OP_HPP
  3. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
  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/is_error.hpp>
  8. #include <boost/metaparse/v1/cpp98/impl/later_result.hpp>
  9. #include <boost/mpl/eval_if.hpp>
  10. namespace boost
  11. {
  12. namespace metaparse
  13. {
  14. namespace v1
  15. {
  16. namespace impl
  17. {
  18. template <class S, class Pos>
  19. struct one_of_fwd_op
  20. {
  21. typedef one_of_fwd_op type;
  22. template <class State, class P>
  23. struct apply :
  24. boost::mpl::eval_if<
  25. typename is_error<State>::type,
  26. boost::mpl::eval_if<
  27. typename is_error<typename P::template apply<S, Pos> >::type,
  28. later_result<State, typename P::template apply<S, Pos> >,
  29. typename P::template apply<S, Pos>
  30. >,
  31. State
  32. >
  33. {};
  34. };
  35. }
  36. }
  37. }
  38. }
  39. #endif