transform_error.hpp 961 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef BOOST_METAPARSE_V1_TRANSFORM_ERROR_HPP
  2. #define BOOST_METAPARSE_V1_TRANSFORM_ERROR_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/mpl/eval_if.hpp>
  9. namespace boost
  10. {
  11. namespace metaparse
  12. {
  13. namespace v1
  14. {
  15. template <class P, class F>
  16. struct transform_error
  17. {
  18. template <class S, class Pos>
  19. struct apply :
  20. boost::mpl::eval_if<
  21. typename is_error<typename P::template apply<S, Pos> >::type,
  22. typename F::template apply<
  23. typename P::template apply<S, Pos>::type
  24. >,
  25. typename P::template apply<S, Pos>
  26. >
  27. {};
  28. typedef transform_error type;
  29. };
  30. }
  31. }
  32. }
  33. #endif