|
ContainersItem 1. Choose your containers with care Item 2. Beware the illusion of container-independent code Item 3. Make copying cheap and correct for objects in containers Item 4. Call empty instead of checking size() against zero Item 5. Prefer range member functions to their single-element counterparts Item 6. Be alert for C++'s most vexing parse Item 7. When using containers of newed pointers, remember to delete the pointers before the container is destroyed Item 8. Never create containers of auto_ptrs Item 9. Choose carefully among erasing options Item 10. Be aware of allocator conventions and restrictions Item 11. Understand the legitimate uses of custom allocators Item 12. Have realistic expectations about the thread safety of STL containers vector and string Item 16. Know how to pass vector and string data to legacy APIs Item 17. Use "the swap trick" to trim excess capacity Item 18. Avoid using vector<bool> Associative Containers Item 19. Understand the difference between equality and equivalence Item 25. Familiarize yourself with the nonstandard hashed containers Iterators Item 26. Prefer iterator to const iterator, reverse_iterator, and const_reverse_iterator Item 27. Use distance and advance to convert a container's const_iterators to iterators Item 28. Understand how to use a reverse_iterator's base iterator Item 32. Follow remove-like algorithms by erase if you really want to remove something Item 33. Be wary of remove-like algorithms on containers of pointers Item 37. Use accumulate or for_each to summarize ranges Functors, Functor Classes, Functions, etc Item 38. Design functor classes for pass-by-value Item 41. Understand the reasons for ptr_fun, mem_fun, and mem_fun_ref Item 42. Make sure less<T> means operator<Programming with the STL Download free ebooks for STL: Effective STL:50 Specific Ways to Improve Your Use of the Standard Template Library
|
Free programing ebooks
Containers