change_error_message.hpp 944 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef BOOST_METAPARSE_V1_CHANGE_ERROR_MESSAGE_HPP
  2. #define BOOST_METAPARSE_V1_CHANGE_ERROR_MESSAGE_HPP
  3. // Copyright Abel Sinkovics ([email protected]) 2011.
  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/reject.hpp>
  9. #include <boost/mpl/eval_if.hpp>
  10. namespace boost
  11. {
  12. namespace metaparse
  13. {
  14. namespace v1
  15. {
  16. template <class P, class Msg>
  17. struct change_error_message
  18. {
  19. template <class S, class Pos>
  20. struct apply :
  21. boost::mpl::eval_if<
  22. typename is_error<typename P::template apply<S, Pos> >::type,
  23. reject<Msg, Pos>,
  24. typename P::template apply<S, Pos>
  25. >
  26. {};
  27. typedef change_error_message type;
  28. };
  29. }
  30. }
  31. }
  32. #endif