November 2001
Beginner
1128 pages
29h 12m
English
The string class is based on a template definition:
template<class charT, class traits = char_traits<charT>,
class Allocator = allocator<charT> >
class basic_string {...};
Here charT represents the type stored in the string. The traits parameter represents a class that defines necessary properties a type must possess to be represented as a string. For example, it should have a length() method that returns the length of a string represented as an array of type charT. The end of such an array is indicated by the value charT(0), the generalization of the null character. (The expression charT(0) is a type cast of 0 to type charT. It could be just a 0, as it is for type char, or, more generally, it could be ...
Read now
Unlock full access