1 / 198
文档名称:

Effective STL - 50 Specific Ways to Improve Your Use of the Standard Template Library (Addison Wesley, 2001, 0201749629).pdf

格式:pdf   页数:198
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

Effective STL - 50 Specific Ways to Improve Your Use of the Standard Template Library (Addison Wesley, 2001, 0201749629).pdf

上传人:bolee65 2013/12/12 文件大小:0 KB

下载得到文件列表

Effective STL - 50 Specific Ways to Improve Your Use of the Standard Template Library (Addison Wesley, 2001, 0201749629).pdf

文档介绍

文档介绍:Content
Containers ................................................................................................................... 1
Item 1. Choose your containers with care........................................................... 1
Item 2. Beware the illusion of container-independent code................................ 4
Item 3. Make copying cheap and correct for objects in containers..................... 9
Item 4. Call empty instead of checking size() against zero. ............................. 11
Item 5. Prefer range member functions to their single-element counterparts... 12
Item 6. Be alert for C++'s most vexing parse................................................... 20
Item 7. When using containers of newed pointers, remember to delete the
pointers before the container is destroyed. ........................................................... 22
Item 8. Never create containers of auto_ptrs. ................................................... 27
Item 9. Choose carefully among erasing options.............................................. 29
Item 10. Be aware of allocator conventions and restrictions. ......................... 34
Item 11. Understand the legitimate uses of custom allocators........................ 40
Item 12. Have realistic expectations about the thread safety of STL containers.
43
vector and string........................................................................................................ 48
Item 13. Prefer vector and string to dynamically allocated arrays.................. 48
Item 14. Use reserve to avoid unnecessary reallocations................................ 50
Item 15. Be aware of variations in string implementations. ........................... 52
Item 16. Know how to pass vector and string data to legacy APIs. ............... 57
Item 17. Use "the swap trick" to trim excess capacity.................................... 60
Item 18. Avoid using vector<bool>. .