Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library (Addison-Wesley Professional Computing Series)

Free Download

Authors:

Size: 1 MB (1531035 bytes)

Pages: 198/198

File format:

Language:

Publishing Year:

Category: Tags: , ,

Scott Meyers

always been a challenge. Until now. In this book, best-selling author Scott Meyers (Effective C++, and More Effective C++) reveals the critical rules of thumb employed by the experts – the things they almost always do or almost always avoid doing – to get the most out of the library.Other books describe what’s in the STL. Effective STL shows you how to use it. Each of the book’s 50 guidelines is backed by Meyers’ legendary analysis and incisive examples, so you’ll learn not only what to do, but also when to do it – and why.Highlights of Effective STL include:Advice on choosing among standard STL containers (like vector and list), nonstandard STL containers (like hash_set and hash_map), and non-STL containers (like bitset).Techniques to maximize the efficiency of the STL and the programs that use it.Insights into the behavior of iterators, function objects, and allocators, including things you should not do. Guidance for the proper use of algorithms and member functions whose names are the same (e.g., find), but whose actions differ in subtle (but important) ways.Discussions of potential portability problems, including straightforward ways to avoid them. Like Meyers’ previous books, Effective STL is filled with proven wisdom that comes only from experience. Its clear, concise, penetrating style makes it an essential resource for every STL programmer.

Table of contents :
Effective STL: 50 Specific Ways to Improve Your Use of Standard Template Library……Page 1
Content……Page 2
1. Choose your containers with care……Page 6
2. Beware illusion of container-independent code……Page 9
3. Make copying cheap & correct for objects in containers……Page 14
4. Call empty instead of checking size() against zero……Page 16
5. Prefer range member functions to their single-element counterparts……Page 17
6. Be alert for C++’s most vexing parse……Page 25
7. When using containers of newed pointers, remember to delete pointers before container is destroyed……Page 27
8. Never create containers of auto_ptrs……Page 32
9. Choose carefully among erasing options……Page 34
10. Be aware of allocator conventions & restrictions……Page 39
11. Understand legitimate uses of custom allocators……Page 45
12. Have realistic expectations about thread safety of STL containers……Page 48
13. Prefer vector & string to dynamically allocated arrays……Page 53
14. Use reserve to avoid unnecessary reallocations……Page 55
15. Be aware of variations in string implementations……Page 57
16. Know how to pass vector & string data to legacy APIs…….Page 62
17. Use “swap trick” to trim excess capacity……Page 65
18. Avoid using vector……Page 67
19. Understand difference between equality & equivalence……Page 70
20. Specify comparison types for associative containers of pointers……Page 74
21. Always have comparison functions return false for equal values……Page 78
22. Avoid in-place key modification in set & multiset……Page 81
23. Consider replacing associative containers with sorted vectors……Page 86
24. Choose carefully between map::operator[] & map-insert when efficiency is important……Page 92
25. Familiarize yourself with nonstandard hashed containers……Page 96
26. Prefer iterator to const iterator, reverse_iterator & const_reverse_iterator……Page 100
27. Use distance & advance to convert container’s const_iterators to iterators……Page 103
28. Understand how to use reverse_iterator’s base iterator……Page 106
29. Consider istreambuf_iterators for character-by-character input……Page 108
30. Make sure destination ranges are big enough……Page 111
31. Know your sorting options……Page 116
32. Follow remove-like algorithms by erase if you really want to remove something……Page 121
33. Be wary of remove-like algorithms on containers of pointers……Page 125
34. Note which algorithms expect sorted ranges……Page 128
35. Implement simple case-insensitive string comparisons via mismatch or lexicographical compare……Page 131
36. Understand proper implementation of copy_if……Page 135
37. Use accumulate or for_each to summarize ranges……Page 137
38. Design functor classes for pass-by-value……Page 143
39. Make predicates pure functions……Page 146
40. Make functor classes adaptable……Page 149
41. Understand reasons for ptr_fun, mem_fun & mem_fun_ref……Page 153
42. Make sure less means operator

Reviews

There are no reviews yet.

Be the first to review “Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library (Addison-Wesley Professional Computing Series)”
Shopping Cart
Scroll to Top