stlab.adobe.com Adobe Systems Incorporated

char_traits

utilities.gif
type.gif
Category: utilities Component type: type

Description

The char_traits class is the default character_traits class used by the library; it is the only predefined character_traits class.

Example

The char_traits class is of no use by itself. It is used as a template parameter of other classes, such as the basic_string template.

Definition

Defined in the standard header string.

Template parameters

Parameter Description Default
charT char_traits's value type, i.e. char_traits<>char_type.  

Model of

character_traits

Type requirements

charT is either char or wchar_t.

(All of char_traits's member functions are defined for arbitrary types, but some of char_traits's members must be explicitly specialized if char_traits is to be useful for other types than char and wchar_t.

Public base classes

None.

Members

All of char_traits's members are static. There is never any reason to create an object of type char_traits.

Member Where defined Description
char_type character_traits char_traits's value type: charT.
int_type character_traits char_traits's int type.
pos_type character_traits char_traits's position type.
off_type character_traits char_traits's offset type
state_type character_traits char_traits's state type.
static void assign(char_type& c1, const char_type& c2) character_traits Assigns c2 to c1.
static bool eq(const char_type& c1, const char_type& c2) character_traits Character equality.
static bool lt(const char_type& c1, const char_type& c2) character_traits Returns true if c1 is less than c2.
static int compare(const char_type* p1, const char_type* p2, size_t n) character_traits Three-way lexicographical comparison, much like strncmp.
Length static size_t length(const char* p) Returns length of a null-terminated array of characters.
static const char_type* find(const char_type* p, size_t n, const char_type& c) character_traits Finds c in [p, p+n), returning 0 if not found.
static char_type* move(char_type* s, const char_type* p, size_t n) character_traits Copies characters from [p, p+n) to the (possibly overlapping) range [s, s+n).
static char_type* copy(char_type* s, const char_type* p, size_t n) character_traits Copies characters from [p, p+n) to the (non-overlapping) range [s, s+n).
static char_type* assign(char_type* s, size_t n, char_type c) character_traits Assigns the value c to every element in the range [s, s+n).
static int_type eof() character_traits Returns the value used as an EOF indicator.
static int_type not_eof(const int_type& c) character_traits Returns a value that is not equal to eof(). Returns c unless c is equal to eof().
static char_type to_char_type(const int_type& c) character_traits Returns the char_type value corresponding to c, if such a value exists.
static int_type to_int_type(const char_type& c) character_traits Returns a int_type representation of c.
static bool eq_int_type(cosnt int_type& c1, const int_type& c1) character_traits Tests whether two int_type values are equal. If the values can also be represented as char_type, then eq and eq_int_type must be consistent with each other.

New members

None. All of char_traits's members are defined in the character_traits requirements.

Notes

See also

character_traits, basic_string

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google