Home | Libraries | People | FAQ | More |
namespace util { template <class D> struct digit_to_int; }
This is a lazy template metafunction that supports currying.
Converts a boxed character containing a value in the range ['0'..'9']
to an
integer.
It returns a boxed integer value.
#include <boost/metaparse/util/digit_to_int.hpp>
For any C
boxed character
value in the range ['0'..'9']
the following expressions are equivalent
digit_to_int<>::apply<C>::type digit_to_int<C>::type digit_to_int_c<C::type::value>::type
#include <boost/metaparse/util/digit_to_int.hpp> #include <type_traits> using namespace boost::metaparse; struct nullary_metafunction_returning_4 { using type = std::integral_constant<char, '4'>; }; static_assert( util::digit_to_int<std::integral_constant<char, '0'>>::type::value == 0, "it should convert a character to the corresponding integer value" ); static_assert( util::digit_to_int<>::type ::apply<std::integral_constant<char, '7'>>::type::value == 7, "it should support currying" ); static_assert( util::digit_to_int<nullary_metafunction_returning_4>::type::value == 4, "it should support lazy evaluation" );