digit_to_int_c.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef BOOST_METAPARSE_V1_UTIL_DIGIT_TO_INT_C_HPP
  2. #define BOOST_METAPARSE_V1_UTIL_DIGIT_TO_INT_C_HPP
  3. // Copyright Abel Sinkovics ([email protected]) 2013.
  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/error/digit_expected.hpp>
  8. #include <boost/mpl/int.hpp>
  9. namespace boost
  10. {
  11. namespace metaparse
  12. {
  13. namespace v1
  14. {
  15. namespace util
  16. {
  17. template <char C>
  18. struct digit_to_int_c : error::digit_expected {};
  19. template <> struct digit_to_int_c<'0'> : boost::mpl::int_<0> {};
  20. template <> struct digit_to_int_c<'1'> : boost::mpl::int_<1> {};
  21. template <> struct digit_to_int_c<'2'> : boost::mpl::int_<2> {};
  22. template <> struct digit_to_int_c<'3'> : boost::mpl::int_<3> {};
  23. template <> struct digit_to_int_c<'4'> : boost::mpl::int_<4> {};
  24. template <> struct digit_to_int_c<'5'> : boost::mpl::int_<5> {};
  25. template <> struct digit_to_int_c<'6'> : boost::mpl::int_<6> {};
  26. template <> struct digit_to_int_c<'7'> : boost::mpl::int_<7> {};
  27. template <> struct digit_to_int_c<'8'> : boost::mpl::int_<8> {};
  28. template <> struct digit_to_int_c<'9'> : boost::mpl::int_<9> {};
  29. }
  30. }
  31. }
  32. }
  33. #endif