is_lcase_letter.qbk 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. [#is_lcase_letter]
  2. [section is_lcase_letter]
  3. [h1 Synopsis]
  4. namespace util
  5. {
  6. template <class C>
  7. struct is_lcase_letter;
  8. }
  9. This is a [link lazy_metafunction lazy template metafunction] that supports
  10. [link currying currying].
  11. [table Arguments
  12. [[Name] [Type]]
  13. [[`C`] [[link boxed_value boxed] character value]]
  14. ]
  15. [h1 Description]
  16. Checks if `C` is a lower case letter. Returns a boxed boolean value.
  17. [h1 Header]
  18. #include <boost/metaparse/util/is_lcase_letter.hpp>
  19. [h1 Expression semantics]
  20. The following expressions are equivalent:
  21. is_lcase_letter<>::apply<boost::mpl::char_<'a'>>::type
  22. boost::mpl::true_
  23. is_lcase_letter<>::apply<boost::mpl::char_<'z'>>::type
  24. boost::mpl::true_
  25. is_lcase_letter<>::apply<c>::type
  26. boost::mpl::false_
  27. [h1 Example]
  28. #include <boost/metaparse/util/is_lcase_letter.hpp>
  29. #include <type_traits>
  30. using namespace boost::metaparse;
  31. struct returns_char
  32. {
  33. using type = std::integral_constant<char, 'a'>;
  34. };
  35. static_assert(
  36. util::is_lcase_letter<std::integral_constant<char, 'a'>>::type::value,
  37. "a should be a lower case letter"
  38. );
  39. static_assert(
  40. !util::is_lcase_letter<std::integral_constant<char, 'A'>>::type::value,
  41. "A should not be a lower case letter"
  42. );
  43. static_assert(
  44. util::is_lcase_letter<>::type
  45. ::apply<std::integral_constant<char, 'a'>>::type::value,
  46. "it should support currying"
  47. );
  48. static_assert(
  49. util::is_lcase_letter<returns_char>::type::value,
  50. "it should support lazy evaluation"
  51. );
  52. [endsect]