Home | Libraries | People | FAQ | More |
namespace util { template <char D> struct digit_to_int_c; }
This is a template class similar to a template
metafunction but taking a char
value as argument.
Converts a 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_c.hpp>
The following pairs of expressions are equivalent
digit_to_int_c<'0'>::type boost::mpl::int_<0> digit_to_int_c<'9'>::type boost::mpl::int_<9>
#include <boost/metaparse/util/digit_to_int_c.hpp> using namespace boost::metaparse; static_assert( util::digit_to_int_c<'0'>::type::value == 0, "it should convert a character to the corresponding integer value" ); static_assert( util::digit_to_int_c<'3'>::type::value == 3, "it should convert a character to the corresponding integer value" ); static_assert( util::digit_to_int_c<'9'>::type::value == 9, "it should convert a character to the corresponding integer value" );