Appendix F. The string
Template Class
Much of this appendix is a bit technical. However, if you just want to know the capabilities of the string
template class, you can concentrate on the descriptions of the various string
methods.
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 that 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 ...
Get C++ Primer Plus, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.