-
Book Overview & Buying
-
Table Of Contents
C++ STL Cookbook - Second Edition
By :
One of the more significant differences between C and C++ is the distinction between object construction and initialization. Because C++ has classes, object construction and initialization are necessarily more complex than in C, which does not have classes. As we dive more deeply into the STL, it is vitally important to understand this distinction and to write code that expresses it clearly.
Source code is the bridge between the programmer and the compiler. That makes it necessary to write code that is both effective and readable. If we fail to understand how our objects are constructed, from both classes and primitive types, we invite confusion, which can lead to maddeningly elusive bugs.
Modern C++ provides several ways to initialize objects. The two most common are copy initialization and braced initialization:
std::string name = "Jimi Hendrix"; // copy initialization
std::string name {"Jimi Hendrix"};...
Change the font size
Change margin width
Change background colour