没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Effective C++ Third Edition
55 Specific Ways to Improve
Your Programs and Designs
@Team DDU
Effective C++ Third Edition 55 Specific Ways to Improve Your Programs and Designs @Team
DDU
1
Table Of Contents
1. Effective C++ Third Edition 55 Specific Ways to Improve Your Programs and Designs ............ 5
2. Table of Contents ...................................................................................................................... 5
3. Copyright ................................................................................................................................... 8
4. Praise for Effective C++, Third Edition .................................................................................... 10
5. Addison-Wesley Professional Computing Series .................................................................... 12
6. Preface .................................................................................................................................... 14
7. Acknowledgments ................................................................................................................... 16
8. Introduction ............................................................................................................................ 19
8.1 Terminology ...................................................................................................................... 20
9. Chapter 1. Accustoming Yourself to C++ ................................................................................ 30
9.1 Item 1: View C++ as a federation of languages ................................................................. 31
9.2 Item 2: Prefer consts, enums, and inlines to #defines...................................................... 32
9.3 Item 3: Use const whenever possible ............................................................................... 37
9.4 Item 4: Make sure that objects are initialized before they're used ................................. 52
10. Chapter 2. Constructors, Destructors, and Assignment Operators ...................................... 61
10.1 Item 5: Know what functions C++ silently writes and calls............................................. 62
10.2 Item 6: Explicitly disallow the use of compiler-generated functions you do not want .. 67
10.3 Item 7: Declare destructors virtual in polymorphic base classes ................................... 70
10.4 Item 8: Prevent exceptions from leaving destructors .................................................... 76
10.5 Item 9: Never call virtual functions during construction or destruction ........................ 83
10.6 Item 10: Have assignment operators return a reference to *this .................................. 88
10.7 Item 11: Handle assignment to self in operator= ........................................................... 90
10.8 Item 12: Copy all parts of an object ................................................................................ 96
11. Chapter 3. Resource Management ..................................................................................... 101
11.1 Item 13: Use objects to manage resources. ................................................................. 102
11.2 Item 14: Think carefully about copying behavior in resource-managing classes. ........ 109
11.3 Item 15: Provide access to raw resources in resource-managing classes. ................... 113
11.4 Item 16: Use the same form in corresponding uses of new and delete. ...................... 120
11.5 Item 17: Store newed objects in smart pointers in standalone statements. ............... 123
12. Chapter 4. Designs and Declarations .................................................................................. 125
12.1 Item 18: Make interfaces easy to use correctly and hard to use incorrectly ............... 125
12.2 Item 19: Treat class design as type design .................................................................... 133
Effective C++ Third Edition 55 Specific Ways to Improve Your Programs and Designs @Team
DDU
2
12.3 Item 20: Prefer pass-by-reference-to-const to pass-by-value ...................................... 134
12.4 Item 21: Don't try to return a reference when you must return an object .................. 140
12.5 Item 22: Declare data members private ....................................................................... 146
12.6 Item 23: Prefer non-member non-friend functions to member functions ................... 150
12.7 Item 24: Declare non-member functions when type conversions should apply to all
parameters ............................................................................................................................ 155
12.8 Item 25: Consider support for a non-throwing swap ................................................... 160
13. Chapter 5. Implementations ............................................................................................... 170
13.1 Item 26: Postpone variable definitions as long as possible. ......................................... 170
13.2 Item 27: Minimize casting. ............................................................................................ 175
13.3 Item 28: Avoid returning "handles" to object internals. .............................................. 185
13.4 Item29: Strive for exception-safe code......................................................................... 190
13.5 Item 30: Understand the ins and outs of inlining. ........................................................ 200
13.6 Item31: Minimize compilation dependencies between files. ....................................... 206
14. Chapter 6. Inheritance and Object-Oriented Design .......................................................... 219
14.1 Item 32: Make sure public inheritance models "is-a." ................................................. 220
14.2 Item 33: Avoid hiding inherited names......................................................................... 228
14.3 Item 34: Differentiate between inheritance of interface and inheritance of
implementation .................................................................................................................... 238
14.4 Item 35: Consider alternatives to virtual functions ...................................................... 249
14.5 Item 36: Never redefine an inherited non-virtual function .......................................... 262
14.6 Item 37: Never redefine a function's inherited default parameter value .................... 265
14.7 Item 38: Model "has-a" or "is-implemented-in-terms-of" through composition ........ 270
14.8 Item 39: Use private inheritance judiciously ................................................................ 274
14.9 Item 40: Use multiple inheritance judiciously .............................................................. 281
15. Chapter 7. Templates and Generic Programming .............................................................. 291
15.1 Item 41: Understand implicit interfaces and compile-time polymorphism ................. 292
15.2 Item 42: Understand the two meanings of typename ................................................. 296
15.3 Item 43: Know how to access names in templatized base classes ............................... 302
15.4 Item 44: Factor parameter-independent code out of templates ................................. 311
15.5 Item 45: Use member function templates to accept "all compatible types." .............. 318
15.6 Item 46: Define non-member functions inside templates when type conversions are
desired .................................................................................................................................. 324
15.7 Item 47: Use traits classes for information about types ............................................... 331
15.8 Item 48: Be aware of template metaprogramming ...................................................... 340
Effective C++ Third Edition 55 Specific Ways to Improve Your Programs and Designs @Team
DDU
3
16. Chapter 8. Customizing new and delete ............................................................................. 347
16.1 Item 49: Understand the behavior of the new-handler ............................................... 348
16.2 Item 50: Understand when it makes sense to replace new and delete ....................... 359
16.3 Item 51: Adhere to convention when writing new and delete .................................... 363
16.4 Item 52: Write placement delete if you write placement new .................................... 369
17. Chapter 9. Miscellany ......................................................................................................... 378
17.1 Item 53: Pay attention to compiler warnings. .............................................................. 379
17.2 Item 54: Familiarize yourself with the standard library, including TR1 ........................ 380
17.3 Item.55: Familiarize yourself with Boost. ..................................................................... 385
18. Appendix A. Beyond Effective C++ ...................................................................................... 389
19. Appendix B. Item Mappings Between Second and Third Editions ...................................... 395
20. Index ................................................................................................................................... 396
20.1 index_SYMBOL .............................................................................................................. 397
20.2 index_A ......................................................................................................................... 398
20.3 index_B ......................................................................................................................... 399
20.4 index_C ......................................................................................................................... 400
20.5 index_D ......................................................................................................................... 405
20.6 index_E .......................................................................................................................... 407
20.7 index_F .......................................................................................................................... 416
20.8 index_G ......................................................................................................................... 417
20.9 index_H ......................................................................................................................... 417
20.10 index_I ......................................................................................................................... 418
20.11 index_J ........................................................................................................................ 421
20.12 index_K ....................................................................................................................... 422
20.13 index_L ........................................................................................................................ 422
20.14 index_M ...................................................................................................................... 423
20.15 index_N ....................................................................................................................... 425
20.16 index_O ....................................................................................................................... 426
20.17 index_P........................................................................................................................ 428
20.18 index_R ....................................................................................................................... 430
20.19 index_S ........................................................................................................................ 432
20.20 index_T ........................................................................................................................ 435
20.21 index_U ....................................................................................................................... 437
20.22 index_V ....................................................................................................................... 438
Effective C++ Third Edition 55 Specific Ways to Improve Your Programs and Designs @Team
DDU
4
20.23 index_W ...................................................................................................................... 439
20.24 index_X ....................................................................................................................... 440
20.25 index_Z ........................................................................................................................ 440
剩余440页未读,继续阅读
资源评论
- wj301X2012-08-29字迹清晰,总体感觉比较好。
shenweixin
- 粉丝: 0
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功