is_ucase_letter.qbk 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. [#is_ucase_letter]
  2. [section is_ucase_letter]
  3. [h1 Synopsis]
  4. namespace util
  5. {
  6. template <class C>
  7. struct is_ucase_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 an upper case letter. Returns a boxed boolean value.
  17. [h1 Header]
  18. #include <boost/metaparse/util/is_ucase_letter.hpp>
  19. [h1 Expression semantics]
  20. The following expressions are equivalent:
  21. is_ucase_letter<>::apply<boost::mpl::char_<'A'>>::type
  22. boost::mpl::true_
  23. is_ucase_letter<>::apply<boost::mpl::char_<'Z'>>::type
  24. boost::mpl::true_
  25. is_ucase_letter<>::apply<c>::type
  26. boost::mpl::false_
  27. [h1 Example]
  28. #include <boost/metaparse/util/is_ucase_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_ucase_letter<std::integral_constant<char, 'A'>>::type::value,
  37. "A should be an upper case letter"
  38. );
  39. static_assert(
  40. !util::is_ucase_letter<std::integral_constant<char, 'a'>>::type::value,
  41. "a should not be an upper case letter"
  42. );
  43. static_assert(
  44. util::is_ucase_letter<>::type
  45. ::apply<std::integral_constant<char, 'A'>>::type::value,
  46. "it should support currying"
  47. );
  48. static_assert(
  49. util::is_ucase_letter<returns_char>::type::value,
  50. "it should support lazy evaluation"
  51. );
  52. [endsect]