String package
Character Traits
Category: utilities
Component type: concept
Several library components, including strings, need to perform operations on characters. A Character Traits class is similar to a function object: it encapsulates some information about a particular character type, and some operations on that type.
Note that every member of a Character Traits class is static. There is never any need to create a Character Traits object, and, in fact, there is no guarantee that creating such objects is possible.
Character Traits is not a refinement of any other concept.
| Value type | X::char_type | The character type described by this Character Traits type. |
| Int type | X::int_type | A type that is capable of representing every valid value of type |
| Position type | X::pos_type | A type that can represent the position of a character of type |
| Offset type | X::off_type | An integer type that can represent the difference between two |
| State type | X::state_type | A type that can represent a state in a multibyte encoding scheme. This type, if used at all, is usually |
X A type that is a model of Character Traits.
c, c1, c2 A value of
e, e1, e2 A value of
n A value of type
p, p1, p2 A non-null pointer of type
s A non-null pointer of type
| Name | Expression | Type requirements | Return type |
|---|---|---|---|
| Character assignment | X::assign(c1, c2) | void | |
| Character equality | X::eq(c1, c2) | bool | |
| Character comparison | X::lt(c1, c2) | bool | |
| Range comparison | X::compare(p1, p2, n) | int | |
| Length | X::length(p) | size_t |
