71 lines
1.2 KiB
Plaintext
71 lines
1.2 KiB
Plaintext
[#is_whitespace_c]
|
|
[section is_whitespace_c]
|
|
|
|
[h1 Synopsis]
|
|
|
|
namespace util
|
|
{
|
|
template <char C>
|
|
struct is_whitespace_c;
|
|
}
|
|
|
|
This is a template class similar to a [link metafunction template metafunction]
|
|
but taking a `char` value as argument.
|
|
|
|
[table Arguments
|
|
[[Name] [Type]]
|
|
[[`D`] [`char` value]]
|
|
]
|
|
|
|
[h1 Description]
|
|
|
|
Checks if `C` is a whitespace character. Returns a boxed boolean value.
|
|
|
|
[h1 Header]
|
|
|
|
#include <boost/metaparse/util/is_whitespace_c.hpp>
|
|
|
|
[h1 Expression semantics]
|
|
|
|
The following expressions are equivalent:
|
|
|
|
is_whitespace_c<' '>::type
|
|
boost::mpl::true_
|
|
|
|
is_whitespace_c<'\t'>::type
|
|
boost::mpl::true_
|
|
|
|
is_whitespace_c<'\r'>::type
|
|
boost::mpl::true_
|
|
|
|
is_whitespace_c<'\n'>::type
|
|
boost::mpl::true_
|
|
|
|
For any `c` character other than the above listed ones the following are
|
|
equivalent:
|
|
|
|
is_whitespace_c<c>::type
|
|
boost::mpl::false_
|
|
|
|
[h1 Example]
|
|
|
|
#include <boost/metaparse/util/is_whitespace_c.hpp>
|
|
|
|
#include <type_traits>
|
|
|
|
using namespace boost::metaparse;
|
|
|
|
static_assert(
|
|
util::is_whitespace_c<' '>::type::value,
|
|
"a space should be a whitespace character"
|
|
);
|
|
|
|
static_assert(
|
|
!util::is_whitespace_c<'0'>::type::value,
|
|
"a number should not be a whitespace character"
|
|
);
|
|
|
|
|
|
[endsect]
|
|
|