[翻译] Effective C++, 3rd Edition, 附录 A. 超越 Effective C++
来源:互联网 发布:苹果6的蜂窝数据打不开 编辑:程序博客网 时间:2024/05/18 01:35
附录 A. 超越 Effective C++
作者:Scott Meyers
译者:fatalerror99 (iTePub's Nirvana)
发布:http://blog.csdn.net/fatalerror99/
Effective C++ 覆盖了我认为对当前的 C++ 程序员最重要的通用指导方针,但是如果你有兴趣在更多的方面提升你的效力,我推荐你去研读我的其他 C++ 书籍,More Effective C++ 和 Effective STL。
More Effective C++ 覆盖其它的编程指导方针,并包括像效率和带有异常编程这样的话题的广泛讨论。它也记述了像 smart pointers(智能指针),reference counting(引用计数)和 proxy objects(代理对象)这样的重要的 C++ 编程技术。
Effective STL 像 Effective C++ 一样是一本面向指导方针的书,但是它专注于标准模板库的有效使用。
下面是这两本书的目录摘要。
Contents of More Effective C++
Basics
Item 1: Distinguish between pointers and references
Item 2: Prefer C++-style casts
Item 3: Never treat arrays polymorphically
Item 4: Avoid gratuitous default constructorsOperators
Item 5: Be wary of user-defined conversion functions
Item 6: Distinguish between prefix and postfix forms of increment and decrement operators
Item 7: Never overload &&, ||, or,
Item 8: Understand the different meanings of new and deleteExceptions
Item 9: Use destructors to prevent resource leaks
Item 10: Prevent resource leaks in constructors
Item 11: Prevent exceptions from leaving destructors
Item 12: Understand how throwing an exception differs from passing a parameter or calling a virtual function
Item 13: Catch exceptions by reference
Item 14: Use exception specifications judiciously
Item 15: Understand the costs of exception handlingEfficiency
Item 16: Remember the 80-20 rule
Item 17: Consider using lazy evaluation
Item 18: Amortize the cost of expected computations
Item 19: Understand the origin of temporary objects
Item 20: Facilitate the return value optimization
Item 21: Overload to avoid implicit type conversions
Item 22: Consider using op= instead of stand-alone op
Item 23: Consider alternative libraries
Item 24: Understand the costs of virtual functions, multiple inheritance, virtual base classes, and RTTITechniques
Item 25: Virtualizing constructors and non-member functions
Item 26: Limiting the number of objects of a class
Item 27: Requiring or prohibiting heap-based objects
Item 28: Smart pointers
Item 29: Reference counting
Item 30: Proxy classes
Item 31: Making functions virtual with respect to more than one objectMiscellany
Item 32: Program in the future tense
Item 33: Make non-leaf classes abstract
Item 34: Understand how to combine C++ and C in the same program
Item 35: Familiarize yourself with the language standard
Contents of Effective STL
Chapter 1: Containers
Item 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.Chapter 2: vector and string
Item 13: Prefer vector and string to dynamically allocated arrays.
Item 14: Use reserve to avoid unnecessary reallocations.
Item 15: Be aware of variations in string implementations.
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>.Chapter 3: Associative Containers
Item 19: Understand the difference between equality and equivalence.
Item 20: Specify comparison types for associative containers of pointers.
Item 21: Always have comparison functions return false for equal values.
Item 22: Avoid in-place key modification in set and multiset.
Item 23: Consider replacing associative containers with sorted vectors.
Item 24: Choose carefully between map::operator[] and map::insert when efficiency is important.
Item 25: Familiarize yourself with the nonstandard hashed containers.Chapter 4: 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 29: Consider istreambuf_iterators for character-by-character input.Chapter 5: Algorithms
Item 30: Make sure destination ranges are big enough.
Item 31: Know your sorting options.
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 34: Note which algorithms expect sorted ranges.
Item 35: Implement simple case-insensitive string comparisons via mismatch or lexicographical_compare.
Item 36: Understand the proper implementation of copy_if.
Item 37: Use accumulate or for_each to summarize ranges.Chapter 6: Functors, Functor Classes, Functions, etc.
Item 38: Design functor classes for pass-by-value.
Item 39: Make predicates pure functions.
Item 40: Make functor classes adaptable.
Item 41: Understand the reasons for ptr_fun, mem_fun, and mem_fun_ref.
Item 42: Make sure less<T> means operator<.Chapter 7: Programming with the STL
Item 43: Prefer algorithm calls to hand-written loops.
Item 44: Prefer member functions to algorithms with the same names.
Item 45: Distinguish among count, find, binary_search, lower_bound, upper_bound, and equal_range.
Item 46: Consider function objects instead of functions as algorithm parameters.
Item 47: Avoid producing write-only code.
Item 48: Always #include the proper headers.
Item 49: Learn to decipher STL-related compiler diagnostics.
Item 50: Familiarize yourself with STL-related web sites.
- [翻译] Effective C++, 3rd Edition, 附录 A. 超越 Effective C++
- [翻译] Effective C++, 3rd Edition, 附录 B. 第二和第三版之间的 Item 映射
- [翻译] Effective C++, 3rd Edition, Preface(前言)
- [翻译] Effective C++, 3rd Edition, Introduction(导言)
- [翻译] Effective C++, 3rd Edition, Terminology(术语)
- [原创]强烈推荐,正在翻译的《Effective C++,3rd Edition》
- [翻译] Effective C++, 3rd Edition, Chapter 1. 习惯于 C++
- [翻译] Effective C++, 3rd Edition, Chapter 5. 实现
- [翻译] Effective C++, 3rd Edition, Item 32: 确保 public inheritance 模拟 "is-a"(上)
- [翻译] Effective C++, 3rd Edition, Item 32: 确保 public inheritance 模拟 "is-a"(下)
- [翻译] Effective C++, 3rd Edition, Item 3: 只要可能就用 const
- [翻译] Effective C++, 3rd Edition, Item 1: 将 C++ 视为语言的联合体
- [翻译] Effective C++, 3rd Edition, Item 2: 用 consts, enums 和 inlines 取代 #defines
- [翻译] Effective C++, 3rd Edition, Item 13: 使用 objects(对象)管理资源
- [翻译] Effective C++, 3rd Edition, Item 27: 最少化 casting(强制转型)(上)
- [翻译] Effective C++, 3rd Edition, Item 27: 最少化 casting(强制转型)(下)
- [翻译] Effective C++, 3rd Edition, Item 40: 谨慎使用 multiple inheritance(多继承)
- [翻译] Effective C++, 3rd Edition, Item 42: 理解 typename 的两个含义
- Python:缺失的访问控制?
- ASP学习手记
- ASP.NET 学习手记
- 请教各位高手LINUX9.0安装问题。非常急。谢谢了。
- JSP 学习手记
- [翻译] Effective C++, 3rd Edition, 附录 A. 超越 Effective C++
- 用VB写ASP的组件
- ubuntu编译内核以后生成splash
- 线程 应用程序域 进程 比较区别
- 页面验证码程序(C#)
- ATI非官方驱动安装
- 简单的控制台程序
- RIA 开发感想(二)—— Flash VS Ajax
- 纯真,才有希望 (ZT)