售价: ¥536.00 待定配送费
前翻 后翻
正在播放... 已暂停   您正在聆听的 Audible 音频版本的样品。
查看全部 2 张图片

Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library (英语) 平装 – 2001年6月16日

平均4.5 星
5 星
4 星
3 星
2 星
1 星
平均4.5 星 53条亚马逊美国的评论 us-flag |
| 天天低价·正品质优

显示所有 格式和版本 隐藏其他格式和版本
全新品最低价 非全新品最低价
促销信息: 优惠 买满 ¥168.00 立减 ¥20.00 共1个促销


『2016年度央视中国好书』盘点了2016年唱响主旋律,传播正能量的好书,并通过演讲、访谈、朗读、电视短片等手段分享年度好书,让读者体会好书的文字之美、思想之美、情感之美和艺术之美,以及体验阅读的快乐与意义。 >点击查看『2016年度央视中国好书』完整书单

click to open popover

  • 买满 ¥168.00 立减 ¥20.00: 满足条件自动优惠


  • iPhone/iPad/Mac
  • Android手机或平板电脑



  • 出版社: Addison-Wesley Professional; 1 (2001年6月16日)
  • 丛书名: Addison-Wesley Professional Computing Series
  • 平装: 288页
  • 语种: 英语
  • ISBN: 0201749629
  • 条形码: 9780201749625, 0785342749625
  • 商品尺寸: 18.5 x 2.3 x 22.9 cm
  • 商品重量: 567 g
  • ASIN: 0201749629
  • 用户评分: 分享我的评价
  • 亚马逊热销商品排名: 图书商品里排第1,750,414名 (查看图书商品销售排行榜)
  • 您想告诉我们您发现了更低的价格?



Scott Meyers is one of the world's foremost authorities on C++, providing training and consulting services to clients worldwide. He is the author of the best-selling Effective C++ series of books (Effective C++, More Effective C++, and Effective STL) and of the innovative Effective C++ CD. He is consulting editor for Addison Wesley's Effective Software Development Series and serves on the Advisory Board for The C++ Source (http://www.artima.com/cppsource). He holds a Ph.D. in Computer Science from Brown University. His web site is http://www.aristeia.com.


Preface  xi

Acknowledgments  xv

Introduction  1

Chapter 1: Containers  11

Item 1: Choose your containers with care.  11

Item 2: Beware the illusion of container-independent code.  15

Item 3: Make copying cheap and correct for objects in containers.  20

Item 4: Call empty instead of checking size() against zero.  23

Item 5: Prefer range member functions to their single-element counterparts.  24

Item 6: Be alert for C++’s most vexing parse.  33

Item 7: When using containers of newed pointers, remember to delete the pointers before the container is destroyed.  36

Item 8: Never create containers of auto_ptrs.  40

Item 9: Choose carefully among erasing options.  43

Item 10: Be aware of allocator conventions and restrictions.  48

Item 11: Understand the legitimate uses of custom allocators.  54

Item 12: Have realistic expectations about the thread safety of STL containers.  58

Chapter 2: vector and string  63

Item 13: Prefer vector and string to dynamically allocated arrays.  63

Item 14: Use reserve to avoid unnecessary reallocations.  66

Item 15: Be aware of variations in string implementations.  68

Item 16: Know how to pass vector and string data to legacy APIs.  74

Item 17: Use “the swap trick” to trim excess capacity.  77

Item 18: Avoid using vector<bool>.  79

Chapter 3: Associative Containers  83

Item 19: Understand the difference between equality and equivalence.  83

Item 20: Specify comparison types for associative containers of pointers. 88

Item 21: Always have comparison functions return false for equal values.  92

Item 22: Avoid in-place key modification in set and multiset.  95

Item 23: Consider replacing associative containers with sorted vectors.  100

Item 24: Choose carefully between map::operator[] and map::insert when efficiency is important.   106

Item 25: Familiarize yourself with the nonstandard hashed containers.  111

Chapter 4: Iterators  116

Item 26: Prefer iterator to const_iterator, reverse_iterator, and const_reverse_iterator.  116

Item 27: Use distance and advance to convert const_iterators to iterators.   120

Item 28: Understand how to use a reverse_iterator’s base iterator.  123

Item 29: Consider istreambuf_iterators for character by character input.  126

Chapter 5: Algorithms  128

Item 30: Make sure destination ranges are big enough.  129

Item 31: Know your sorting options.  133

Item 32: Follow remove-like algorithms by erase if you really want to remove something.  139

Item 33: Be wary of remove-like algorithms on containers of pointers.  143

Item 34: Note which algorithms expect sorted ranges.  146

Item 35: Implement simple case-insensitive string comparisons via mismatch or lexicographical_compare.  150

Item 36: Understand the proper implementation of copy_if.  154

Item 37: Use accumulate or for_each to summarize ranges.  156

Chapter 6: Functors, Functor Classes, Functions, etc.  162

Item 38: Design functor classes for pass-by-value.  162

Item 39: Make predicates pure functions.  166

Item 40: Make functor classes adaptable.  169

Item 41: Understand the reasons for ptr_fun, mem_fun, and mem_fun_ref.  173

Item 42: Make sure less<T> means operator<.  177

Chapter 7: Programming with the STL  181

Item 43: Prefer algorithm calls to hand-written loops.  181

Item 44: Prefer member functions to algorithms with the same names.  190

Item 45: Distinguish among count, find, binary_search, lower_bound, upper_bound, and equal_range.  192

Item 46: Consider function objects instead of functions as algorithm parameters.  201

Item 47: Avoid producing write-only code.  206

Item 48: Always #include the proper headers.  209

Item 49: Learn to decipher STL-related compiler diagnostics.  210

Item 50: Familiarize yourself with STL-related web sites.  217

Bibliography  225

Appendix A: Locales and Case-Insensitive String Comparisons  229

Appendix B: Remarks on Microsoft’s STL Platforms  239

Index  245


5 星
4 星
3 星
2 星
1 星

此商品在美国亚马逊上最有用的商品评论 (beta)

美国亚马逊: 平均4.5 星 53 条评论
9/9 人认为此评论有用
平均5.0 星 Not timeless, but still a very useful volume 2011年4月11日
评论者 Alexandros Gezerlis - 已在美国亚马逊上发表
版本: 平装 已确认购买
"Effective STL" is the final installment of Scott Meyers' "Effective" trilogy. While the first two volumes ("Effective C++" and "More Effective C++") discussed general tips on C++, "Effective STL" focuses exclusively on the STL, which is taken to mean the parts of the C++ standard library that work with iterators. It goes without saying that this book should be read after "Effective C++, Third Edition". One could probably get away with skipping over "More Effective C++", thus going directly from "Effective C++" to "Effective STL".

The Good: in typical Meyers style, the writing is generally relaxed and even pleasant, e.g. "This works, but only if you're not terribly picky about what you mean by 'works'." (Item 7). Like in "Effective C++" (but in contradistinction to "More Effective C++") most Items are quite short and therefore easily digestible. Similarly, in this volume, too, Meyers often reiterates the main point of each Item before concluding: this sometimes feels needlessly repetitive, but is mostly great for driving home the essential issues. As in the earlier volumes, things are for the most part organized intuitively. Meyers has a knack for pedagogy and thus for different ways of getting the message across, cf. the few tables that are included in the book, most notably the one on search options in Item 45. The author's organizational prowess is also evidenced by the numerous cross-references and the list of performance-related Items at the end of the Introduction. Moving on to the specifics of the material covered in this volume: Meyers is at his best when addressing a host of topics that elsewhere are often jumbled together. The finest examples of this skill are Items 31, 41, and 45, which deal with sorting options, function adapters, and search algorithms, respectively. Meyers manages to methodically explain the commonalities and distinctions between related concepts. The overwhelming majority of the topics covered in this volume have to do with real-life programming in C++, e.g. how to pass vector and string data to legacy APIs (Item 16). In this vein, some of the Items in "Effective STL" can safely be said to constitute required reading, especially the following on: a) range member functions versus their single-element counterparts (Item 5), b) C++'s most vexing parse (Item 6), c) the swap trick used to eliminate excess capacity (Item 17), d) the erase-remove idiom that allows one to really remove elements from a container (Item 32), e) the superiority of algorithm calls in comparison with hand-written loops (Item 43), and f) the advantages of container member functions over STL algorithms with the same name (Item 44). Other Items feel like digressions (e.g. Item 10 on allocators, Item 18 on vector of bools, or Item 23 on replacing associative containers with sorted vectors) though that doesn't make them any less interesting.

The Bad: this volume is not introductory but it isn't a very good reference either. For example, in the early Items Meyers talks about list's splice member functions matter-of-factly. Of course, "Effective C++" and "More Effective C++" are also not introductory or reference works, but there's a major difference: in those books when Meyers discusses a new construct he first explains it briefly. In "Effective STL", on the other hand, he often implicitly assumes the reader will go look stuff up in something like Josuttis' book "The C++ Standard Library" (regarding which Meyers writes: "[e]very C++ programmer should have ready access to a copy"). Obviously, a short hints-and-tips type book cannot contain everything, but the reader's life would have been made much easier had Meyers simply included a few reference tables (containing function signatures) in an Appendix. Moreover, what the Appendices do include is not uniformly interesting: Appendix B addresses developers using Microsoft Visual C++ versions 4-6 and is therefore largely irrelevant today. Another point where "Effective STL" diverges slightly from the earlier volumes' practices is cross-referencing. Meyers mentions other Items extensively in those books, too, but here he's gone overboard: for example, by the time he introduces unary_function and binary_function in Item 40, he has referred to them 10 times already, which probably means that they should have been covered (way) earlier. On a different note, given the non-exhaustive nature of the book, there's important stuff that's missing, e.g. there's absolutely no mention of the at() member function of vectors, deques, and strings. Also, a few of the examples feel somewhat contrived (e.g. anyone paying attention up to that point can tell that the initially proposed solution in Item 42 is obviously unnecessary), though this is more the exception than the rule. Finally, the book's age is starting to show: "Effective STL" was published in 2001 so (despite being more up to date than "More Effective C++") a number of things would be done differently today. For example, Meyers uses for_each in many code snippets, most of which would look much cleaner using lambdas.

In a nutshell, I would say that this book is not as indispensable as "Effective C++, Third Edition", but is probably more useful than "More Effective C++". Meyers is a talented author and instructor, so all three volumes are worth reading. Were "Effective STL" to be re-written today (using C++11 and its library) the result would certainly be more interesting, but the advice contained in this book is solid, nonetheless. Overall, four and a half stars.

Alex Gezerlis
2/2 人认为此评论有用
平均5.0 星 One helluva book 2014年3月6日
评论者 Max - 已在美国亚马逊上发表
版本: 平装 已确认购买
I was brought up on STL with C++, and can't imagine the language without it. This book, however, opened my eyes to many of the strengths, weaknesses, and issues of the Standard Template Library. It tells the reader why to use a deque of booleans instead of vector<bool>. More importantly, it provides warnings about features to avoid, as well as how to make better use of this now standard library. Open source software contributors should also check this book out to understand best practices. There's a temptation in C++ to treat iterators like pointers, but Scott Meyers explains clearly why you shouldn't. He briefly discusses the 100 algorithms that are offered in STL, and several key Items, like "Item 30: Make sure destination ranges are big enough" and "Item 32: Follow remove-like algorithms by erase if you really want to remove something."

Readers even get some of the back story on the decisions that went into the development of STL and why they made some of the compromises that they did. The book is so clear, so lucid, and so interesting that even the novice C++ programmer will enjoy its prose. It is thoroughly informative even for programmers at all levels of experience with C++.
1/1 人认为此评论有用
平均5.0 星 Buy It Now! 2011年1月30日
评论者 Graeme P. Swallow - 已在美国亚马逊上发表
版本: 平装 已确认购买
I am a generally experienced C++ programmer, but I haven't dealt with STL very much. I plan to use it a lot more in the near future, and this sounded to me like a book that would be useful to avoid a lot of pitfalls and establish good habits right off the bat. Man, was this book a smart buy! I would give it 6 stars if I could.

It doesn't take one very long to realize that this book is chock full of insight and wisdom. Every item he presents is a gem. In addition, Mr. Meyers' writing style is more conversational than techie. Don't misunderstand. He really gets into the nitty-gritty of compiler internals and such, but he does it in a way that makes it much more easy to read than material written by holier-than-thou, academia types.

This was the first time I read anything by Mr. Meyers, but based on the quality of this book I plan on buying his "Effective C++" books in the near future.
平均5.0 星 Every C++ Programmer can use this book 2014年8月11日
评论者 Perry Smith - 已在美国亚马逊上发表
版本: 平装 已确认购买
This is a set of do's and don'ts by one of the master C++ programmers / consultants that is still currently active. I believe anyone doing C++ coding will benefit from this book today and in the future. It is useable as a book -- reading it cover to cover or as a reference to refer back about that little thingy that you can't quite remember. Scott has three books very similar. I bought all of them several years ago and praise them to this day.