October 2011
Beginner to intermediate
1200 pages
35h 33m
English
C++11 makes several changes extending the usability of templates in general and the Standard Template Library in particular. Some are in the library itself; others relate to ease of use. In this chapter we’ve already mentioned template aliases and the STL-friendly smart pointers.
for LoopThe range-based for loop (discussed in Chapter 5, “Loops and Relational Expressions,” and Chapter 16) simplifies writing loops for built-in arrays and for classes, such as std::string and the STL containers, that have begin() and end() methods identifying a range. The loop applies the indicated action to each element in the array or container:
double prices[5] = {4.99, 10.99, 6.87, 7.99, 8.49};for (double x : prices) std::cout ...
Read now
Unlock full access