1[#digit_to_int_c] 2[section digit_to_int_c] 3 4[h1 Synopsis] 5 6 namespace util 7 { 8 template <char D> 9 struct digit_to_int_c; 10 } 11 12This is a template class similar to a [link metafunction template metafunction] 13but taking a `char` value as argument. 14 15[table Arguments 16 [[Name] [Type]] 17 [[`D`] [character value]] 18] 19 20[h1 Description] 21 22Converts a character containing a value in the range `['0'..'9']` to an integer. 23 24[h1 Return value] 25 26It returns a [link boxed_value boxed] integer value. 27 28[h1 Header] 29 30 #include <boost/metaparse/util/digit_to_int_c.hpp> 31 32[h1 Expression semantics] 33 34The following pairs of expressions are equivalent 35 36 digit_to_int_c<'0'>::type 37 boost::mpl::int_<0> 38 39 digit_to_int_c<'9'>::type 40 boost::mpl::int_<9> 41 42[h1 Example] 43 44 #include <boost/metaparse/util/digit_to_int_c.hpp> 45 46 using namespace boost::metaparse; 47 48 static_assert( 49 util::digit_to_int_c<'0'>::type::value == 0, 50 "it should convert a character to the corresponding integer value" 51 ); 52 53 static_assert( 54 util::digit_to_int_c<'3'>::type::value == 3, 55 "it should convert a character to the corresponding integer value" 56 ); 57 58 static_assert( 59 util::digit_to_int_c<'9'>::type::value == 9, 60 "it should convert a character to the corresponding integer value" 61 ); 62 63[endsect] 64 65