is_whitespace_c.qbk 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. [#is_whitespace_c]
  2. [section is_whitespace_c]
  3. [h1 Synopsis]
  4. namespace util
  5. {
  6. template <char C>
  7. struct is_whitespace_c;
  8. }
  9. This is a template class similar to a [link metafunction template metafunction]
  10. but taking a `char` value as argument.
  11. [table Arguments
  12. [[Name] [Type]]
  13. [[`D`] [`char` value]]
  14. ]
  15. [h1 Description]
  16. Checks if `C` is a whitespace character. Returns a boxed boolean value.
  17. [h1 Header]
  18. #include <boost/metaparse/util/is_whitespace_c.hpp>
  19. [h1 Expression semantics]
  20. The following expressions are equivalent:
  21. is_whitespace_c<' '>::type
  22. boost::mpl::true_
  23. is_whitespace_c<'\t'>::type
  24. boost::mpl::true_
  25. is_whitespace_c<'\r'>::type
  26. boost::mpl::true_
  27. is_whitespace_c<'\n'>::type
  28. boost::mpl::true_
  29. For any `c` character other than the above listed ones the following are
  30. equivalent:
  31. is_whitespace_c<c>::type
  32. boost::mpl::false_
  33. [h1 Example]
  34. #include <boost/metaparse/util/is_whitespace_c.hpp>
  35. #include <type_traits>
  36. using namespace boost::metaparse;
  37. static_assert(
  38. util::is_whitespace_c<' '>::type::value,
  39. "a space should be a whitespace character"
  40. );
  41. static_assert(
  42. !util::is_whitespace_c<'0'>::type::value,
  43. "a number should not be a whitespace character"
  44. );
  45. [endsect]