1[#is_digit] 2[section is_digit] 3 4[h1 Synopsis] 5 6 namespace util 7 { 8 template <class C> 9 struct is_digit; 10 } 11 12This is a [link lazy_metafunction lazy template metafunction] that supports 13[link currying currying]. 14 15[table Arguments 16 [[Name] [Type]] 17 [[`C`] [[link boxed_value boxed] character value]] 18] 19 20[h1 Description] 21 22Checks if `C` is a digit value or not. Returns a boxed boolean value. 23 24[h1 Header] 25 26 #include <boost/metaparse/util/is_digit.hpp> 27 28[h1 Expression semantics] 29 30The following expressions are equivalent: 31 32 is_digit<boost::mpl::char_<'0'>>::type 33 is_digit<>::apply<boost::mpl::char_<'0'>>::type 34 boost::mpl::true_ 35 36The following expressions are also equivalent: 37 38 is_digit<>::apply<c>::type 39 boost::mpl::false_ 40 41[h1 Example] 42 43 #include <boost/metaparse/util/is_digit.hpp> 44 45 #include <type_traits> 46 47 using namespace boost::metaparse; 48 49 struct returns_char 50 { 51 using type = std::integral_constant<char, '0'>; 52 }; 53 54 static_assert( 55 util::is_digit<std::integral_constant<char, '0'>>::type::value, 56 "digit character should be a digit" 57 ); 58 59 static_assert( 60 !util::is_digit<std::integral_constant<char, 'x'>>::type::value, 61 "letter should not be a digit" 62 ); 63 64 static_assert( 65 util::is_digit<>::type::apply<std::integral_constant<char, '0'>>::type::value, 66 "it should support currying" 67 ); 68 69 static_assert( 70 util::is_digit<returns_char>::type::value, 71 "it should support lazy evaluation" 72 ); 73 74[endsect] 75 76