1[#is_letter] 2[section is_letter] 3 4[h1 Synopsis] 5 6 namespace util 7 { 8 template <class C> 9 struct is_letter; 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 letter. Returns a boxed boolean value. 23 24[h1 Header] 25 26 #include <boost/metaparse/util/is_letter.hpp> 27 28[h1 Expression semantics] 29 30The following expressions are equivalent: 31 32 is_letter<>::apply<boost::mpl::char_<'a'>>::type 33 boost::mpl::true_ 34 35 is_letter<>::apply<boost::mpl::char_<'z'>>::type 36 boost::mpl::true_ 37 38 is_letter<>::apply<boost::mpl::char_<'A'>>::type 39 boost::mpl::true_ 40 41 is_letter<>::apply<boost::mpl::char_<'Z'>>::type 42 boost::mpl::true_ 43 44 is_letter<>::apply<c>::type 45 boost::mpl::false_ 46 47[h1 Example] 48 49 #include <boost/metaparse/util/is_letter.hpp> 50 51 #include <type_traits> 52 53 using namespace boost::metaparse; 54 55 struct returns_char 56 { 57 using type = std::integral_constant<char, 'A'>; 58 }; 59 60 static_assert( 61 util::is_letter<std::integral_constant<char, 'A'>>::type::value, 62 "A should be a letter" 63 ); 64 65 static_assert( 66 !util::is_letter<std::integral_constant<char, '0'>>::type::value, 67 "a number should not be a letter" 68 ); 69 70 static_assert( 71 util::is_letter<>::type 72 ::apply<std::integral_constant<char, 'A'>>::type::value, 73 "it should support currying" 74 ); 75 76 static_assert( 77 util::is_letter<returns_char>::type::value, 78 "it should support lazy evaluation" 79 ); 80 81[endsect] 82 83