if_.hpp 903 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef BOOST_METAPARSE_V1_IF__HPP
  2. #define BOOST_METAPARSE_V1_IF__HPP
  3. // Copyright Abel Sinkovics ([email protected]) 2009 - 2010.
  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/accept.hpp>
  8. #include <boost/metaparse/v1/is_error.hpp>
  9. #include <boost/mpl/if.hpp>
  10. namespace boost
  11. {
  12. namespace metaparse
  13. {
  14. namespace v1
  15. {
  16. template <class P, class T, class F>
  17. struct if_
  18. {
  19. typedef if_ type;
  20. template <class S, class Pos>
  21. struct apply :
  22. accept<
  23. typename boost::mpl::if_<
  24. is_error<typename P::template apply<S, Pos> >,
  25. F,
  26. T
  27. >::type,
  28. S,
  29. Pos
  30. >
  31. {};
  32. };
  33. }
  34. }
  35. }
  36. #endif