Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide

char_traits

Library:  Strings


Does not inherit

Local Index

Members

Summary

A traits class with types and operations for the basic_string container and iostream classes

Synopsis

#include <string>

namespace std {
  template<class charT>
  struct char_traits;
}

Specializations

Description

The structure template char_traits defines the types and functions necessary to implement the iostreams and string class templates. It is templatized on charT, which represents the character container type. Each specialized version of char_traits includes the default definitions corresponding to the specialized character container type.

Users have to provide specialization for char_traits if they use character types other than char and wchar_t.

Interface

Member Types

char_type
int_type
off_type
pos_type
state_type

Types: Default Values

Table 12 lists the default specialization types and their values on char and wchar_t.

Table 12: Default values for types

specialization type on char on wchar_t

char_type

char

wchar_t

int_type

int

wint_t

off_type

streamoff

streamoff

pos_type

streampos

wstreampos

state_type

mbstate_t

mbstate_t

Value Functions

void 
assign(char_type& c1, const char_type& c2);
char_type*
assign(char_type* s, size_t n, char_type a);
char_type* 
copy(char_type* s1, const char_type* s2, size_t n);
int_type 
eof();
const char_type* 
find(const char_type* s, int n, const char_type& a);
size_t 
length(const char_type* s);
char_type* 
move(char_type* s1, const char_type* s2, size_t n);
int_type 
not_eof(const int_type& c);

Test Functions

int 
compare(const char_type* s1,const char_type* s2,size_t n);
bool 
eq(const char_type& c1, const char_type& c2);
bool 
eq_int_type(const int_type& c1, const int_type& c2);
bool 
lt(const char_type& c1,const char_type& c2);

Conversion Functions

char_type 
to_char_type(const int_type& c);
int_type 
to_int_type(const char_type& c);

See Also

iosfwd, fpos

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems --Programming Language C++, Section 21.1



Previous fileTop of DocumentContentsIndex pageNext file