...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A CharSet is a unary predicate which is invocable with this equivalent signature:
bool( char ch ) const noexcept;
The predicate returns true
if
ch
is a member of the set,
or false
otherwise.
is_charset
,
find_if
,
find_if_not
.
In this table:
T
is a type meeting the
requirements of CharSet
t
is a const
value of type T
c
is a value of type
char
first
, last
are values of type char const*
Table 1.37. Valid expressions
Expression |
Type |
Semantics, Pre/Post-conditions |
---|---|---|
|
|
This function returns |
t.find_if(first,last) |
|
This optional member function examines the valid range of characters
in
The implementation of |
t.find_if_not(first,last) |
|
This optional member function examines the valid range of characters
in
The implementation of |
For best results, it is suggested that all constructors and member functions
for character sets be marked constexpr
.
struct CharSet { bool operator()( char c ) const noexcept; // These are both optional. If either or both are left // unspecified, a default implementation will be used. // char const* find_if( char const* first, char const* last ) const noexcept; char const* find_if_not( char const* first, char const* last ) const noexcept; };