在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例Clojure → EffectiveSTL.pdf

EffectiveSTL.pdf

Clojure

下载此实例
  • 开发语言:Others
  • 实例大小:1.82M
  • 下载次数:3
  • 浏览次数:37
  • 发布时间:2023-04-10
  • 实例类别:Clojure
  • 发 布 人:Hermann
  • 文件格式:.pdf
  • 所需积分:2
 相关标签: effectiveSTL

实例介绍

【实例简介】EffectiveSTL.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>................................................................62
Associative Containers..................................................................65
Item 19. Understand the difference between equality and equivalence..........65
Item 20. Specify comparison types for associative containers of pointers.....69
Item 21. Always have comparison functions return false for equal values....73
Item 22. Avoid in-place key modification in set and multiset........................76
Item 23. Consider replacing associative containers with sorted vectors. .......81
Item 24. Choose carefully between map::operator[] and map-insert when
efficiency is important..........................................................................................87
Item 25. Familiarize yourself with the nonstandard hashed containers..........91
Iterators..........................................................................................96
Item 26. Prefer iterator to const iterator, reverse_iterator, and
const_reverse_iterator...........................................................................................96
Item 27. Use distance and advance to convert a container's const_iterators to
iterators. 99
Item 28. Understand how to use a reverse_iterator's base iterator................102
Item 29. Consider istreambuf_iterators for character-by-character input.....104
Algorithms ...................................................................................107
Item 30. Make sure destination ranges are big enough.................................107
Item 31. Know your sorting options. ............................................................112
Item 32. Follow remove-like algorithms by erase if you really want to remove
something. 117
Item 33. Be wary of remove-like algorithms on containers of pointers. ......121
Item 34. Note which algorithms expect sorted ranges..................................124
Item 35. Implement simple case-insensitive string comparisons via mismatch
or lexicographical compare.................................................................................127
Item 36. Understand the proper implementation of copy_if.........................131
Item 37. Use accumulate or for_each to summarize ranges. ........................133
Functors, Functor Classes, Functions, etc.................................139
Item 38. Design functor classes for pass-by-value. ......................................139
Item 39. Make predicates pure functions......................................................142
Item 40. Make functor classes adaptable......................................................145
Item 41. Understand the reasons for ptr_fun, mem_fun, and mem_fun_ref.149
Item 42. Make sure less<T> means operator<..............................................152
Programming with the STL .......................................................156
Item 43. Prefer algorithm calls to hand-written loops. .................................156
Item 44. Prefer member functions to algorithms with the same names........163
Item 45. Distinguish among count, find, binary search, lower_bound,
upper_bound, and equal_range...........................................................................166
Item 46. Consider function objects instead of functions as algorithm
parameters. 174
Item 47. Avoid producing write-only code...................................................178
Item 48. Always #include the proper headers...............................................180
Item 49. Learn to decipher STL-related compiler diagnostics......................182
Item 50. Familiarize yourself with STL-related web sites............................188

标签: effectiveSTL

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警