String package

Character Traits

Category: utilities

Component type: concept

Description

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.

Refinement of

Character Traits is not a refinement of any other concept.

Associated types
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 char_type, and, additionally an end-of-file value. For char, for example, the int type may be int, and for wchar_t it may be wint_t.
Position type X::pos_type A type that can represent the position of a character of type char_type within a file. This type is usually streampos.
Offset type X::off_type An integer type that can represent the difference between two pos_type values. This type is usually streamoff.
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 mbstate_t.
Notation

X A type that is a model of Character Traits.

c, c1, c2 A value of X's value type, X::char_type.

e, e1, e2 A value of X's int type, X::int_type.

n A value of type size_t.

p, p1, p2 A non-null pointer of type const X::char_type*.

s A non-null pointer of type X::char_type*.

Valid Expressions
Name Expression Type requirements Return type
Character assignment X::assign(c1, c2) c1 is a modifiable lvalue. 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
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату