Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

is_whitespace_c

Synopsis

namespace util
{
  template <char C>
  struct is_whitespace_c;
}

This is a template class similar to a template metafunction but taking a char value as argument.

Table 49. Arguments

Name

Type

D

char value


Description

Checks if C is a whitespace character. Returns a boxed boolean value.

Header

#include <boost/metaparse/util/is_whitespace_c.hpp>

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_

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"
);

PrevUpHomeNext