April 2011
Beginner
624 pages
11h 34m
English
Although the Standard Template Library (STL) supports many useful templates, this appendix summarizes the use of just three (the ones used in this book):
• The string class
• The list template
• The stack template
The features in this section require including <string>.
STL string objects are declared simply as string—or std::string if the std namespace is not being used. The simple string class actually instantiates the template class basic_string for type char, so the functions listed here are also supported by basic_string classes:
#include <string>basic_string<char> s1; // Equivalent to stringbasic_string<wchar_t> s2 = L"Hello"; // Wide stringwcout << s2;
Once declared, string objects ...
Read now
Unlock full access