close
 作者:(美)邁耶斯
出版社:機械工業出版社
出版日期:2006-8-1
ISBN7111196244
印次:1
版次:1
紙張:膠版紙

內容提要
C++
的標准模板庫(STL)是革命性的,但是要想學會用好STL卻充滿了挑戰性。中國台灣技術作家侯捷先生曾經把STL的學習過程比喻爲三個境界:
第一境界:熟用STL
第二境界:了解泛型技術的內涵與STL的學理乃至實作。
第三境界:擴充STL
本書無疑是你達到第二境界的最佳讀本。在本書中,C++技術權威Scott Meyers揭示了專家總結的一些關鍵規則,包括他們總是采用的做法以及總是避免的做法。這些規則可以發揮STL的最大效用。
有些書只是描述STL中有些什麽內容,而本書則講述如何使用STL。本書共有50條指導原則,在講述每一條指導原則時,Scott Meyers都提供了透徹的分析和深刻的實例,所以讀者不僅可以學到要做什麽,而且還能夠知道什麽時候該這樣做,以及爲什麽要這樣做。
如同Meyers的其他著作一樣,本書充滿了從實踐中總結出來的智慧。清晰、簡明、透徹的風格使本書成爲每一位STL程序員的案頭必備。
本書特色
●關于選擇容器的建議,涉及的容器有:標准STL容器(例如vectorlist)、非標准的STL容器(例如hash_sethash_map),以及非STL容器(例如bitset)。
●一些提高效率的技術,通過它們可以最大程度地提高STL(以及使用STL的程序)的效率。
●深入到叠代器、函數對象和分配子(allocator)的行爲,也包括程序員總是應該避免的做法。
●對于那些同名的算法和成員函數,如find,根據它們行爲方式上的微妙差異,本書給出了一些指導原則,以保證它們能被正確地使用。
●討論了潛在的移植性問題,包括避免這些移植性問題的各種簡單途徑。

作者簡介
Scott Meyers
,擁有布朗大學計算機科學博士學位,是世界頂級的C++軟件開發技術權威之一。他的兩本暢銷書《Effective C++》和《More Effective C++》開創了技術圖書“Effective”式的寫作風格。他曾擔行《C++ Report》雜志的專欄作家,還經常爲《C/C++ Users Journal》和《Dr.Dobbs Journal》撰稿。

編輯推薦
這是Effective C++的第3卷,還是那麽出色。
——Herb Sutter, ISO/ANSI C++標准委員會主席
所有的C++程序員都必讀的書少之又少,而本書就是其中的一本。
——Thomas Becker, C/C++User Journal》專欄作家

目錄
Preface
Acknowledgments
Introducton
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.
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 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 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.
Bibliography
Appendix A: Locales and Case-Insensitive String Comparisons
Appendix B: Remarks on Microsoft
s STL Platforms
Index
阿寶價:225    宅配:100

 

檢視我的拍賣


arrow
arrow
    全站熱搜

    baosell 發表在 痞客邦 留言(0) 人氣()