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