This struct is a 'functor' whose job it is to tell you whether a given character counts as 'space' in the normal way. You can write your own that have more or less complex tests... To use this struct, you construct an object of this type then execute the object like a funct -- passing it a character. The return value from the function call is a boolean value that tells you whether or not the character you pass in is whitespace. More...
#include <strtool.h>
Public Member Functions | |
bool | operator() (char c) const |
This struct is a 'functor' whose job it is to tell you whether a given character counts as 'space' in the normal way. You can write your own that have more or less complex tests... To use this struct, you construct an object of this type then execute the object like a funct -- passing it a character. The return value from the function call is a boolean value that tells you whether or not the character you pass in is whitespace.
This functor makes its decision based on what the character is. An alternative, is to decide based on what the character is not. For example, you could have a list of characters that are words and some functor could return true if the specified character were not in the list.
To use Is_Space, declare a variable of type Is_Space and treat that variable as if it were a function accepting a character as a parameter and returning a flag indicating that the specified character is a "space". For example:
Is_Space is_space; bool yes = is_space('\t'); // yep, tab is a space
Definition at line 73 of file strtool.h.