is_error.hpp 919 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef BOOST_METAPARSE_V1_IS_ERROR_HPP
  2. #define BOOST_METAPARSE_V1_IS_ERROR_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/fail_tag.hpp>
  8. #include <boost/mpl/tag.hpp>
  9. #include <boost/mpl/vector.hpp>
  10. #include <boost/type_traits/is_same.hpp>
  11. namespace boost
  12. {
  13. namespace metaparse
  14. {
  15. namespace v1
  16. {
  17. template <class T = boost::mpl::na>
  18. struct is_error :
  19. boost::is_same<
  20. fail_tag,
  21. typename boost::mpl::tag<typename T::type>::type
  22. >
  23. {};
  24. template <>
  25. struct is_error<boost::mpl::na>
  26. {
  27. typedef is_error type;
  28. template <class T = boost::mpl::na>
  29. struct apply : is_error<T> {};
  30. };
  31. }
  32. }
  33. }
  34. #endif