SCOTT Meyers' new book Effective STL: 50 strokes to improve STL use technology

zhaozj2021-02-08  460

The SCOTT Meyers of Effective C / More Effective C is about to launch the latest strength: Effective STL, the book is currently completed, I believe you can come out. But I am afraid that Chinese readers may still have to wait. AddIn = Wesley has published the page of this book. Address http://cseng.aw.com/book/toc/0, 3830, 0201749629,00.html

Here is the content of the book: I can basically understand some of the terms, mostly know that it should be, but I don't know how it is, some terms make me quite surprised, so I hope to read it later. I have used [] Writing below for some clauses, I believe it is also what I can explain in the Meyers book. If the netizens interested in STL can discuss these terms, I believe it is very helpful.

Containers

Item 1: choose your containers with cre.

Item 2: BEWARE The Illusion of Container-Independent Code. [It is worth noting the terms! ]

Item 3: make Copying Cheap and Correct for Objects in Containers. [It can be understood, but how to make Cheap, which case is easy to make an incorrect COPY operation? ]

Item 4: Call Empty Instead of Checking Size Against Zero. [What? ]

Item 5: Prefer Range Member Functions to their Single-Element Counterparts. [What? ]

Item 6: Be Alert for C 's Most Vexing Parse. [What is easy! ]

Item 7: When Using Containers of Newed Pointers, Remember to Delete The Pointers Before The Container is destroyed. [You can understand]

Item 8: Never Create Containers of Auto_PTRS. [It can be understood]

Item 9: Choose Carefully Among Erasing Options. [Very interested in interest]

Item 10: Be aware of allocator convention and rates. [Good in-depth topic! ]

Item 11: Understand The LegitiMate Uses of Custom Allocators. [How to do? I know one or two, I hope to strengthen this knowledge]

Item 12: Have Realistic Expections About The Thread Safety of Stl Containers. [Oh, Important Terms]

2. Vector and string.

Item 13: prefer vector and string to Dynamical Allocated arrays. [Right, Basic_String itself is a dynamic array container, don't think that only vector is

Item 14: Use reserve to avoid unnecessary reallocations. Once the VECTOR will find capacity (Capacity) is not enough, it will be careful, or it is very miserable] Item 15: Be aware of variative Wishing to listen to]

Item 16: KNOW How To Pass Vector and String Data To Legacy Apis. [Viva! I know ... Meyers will teach you, let you know what is called well]

Item 17: Use "The Swap Trick" to Trim Excess Capacity. [Ha, I don't understand at all! ]

Item 18: Avoid Using Vector. [Surprise! Completely blow! I have been putting a vector as a preferred container! Meyers, I hope that you give me a reason for this reason.

3. Associative containers.

Item 19: Understand The Difference Between Equality and Equivalence. [Poke to the dead hole, I really don't know what the two are different, immediately check the book]

Item 20: Specify Comparison Types for Associative Containers of Pointers. [Well, make sense! ]

Item 21: Always Have Comparison Functions Return False for Equal Values. [A? Another sunny day! It's a bad thing! But think about, ah, Meyers is really great.

Item 22: Avoid In-Place Key Modification In Set and MultiSet. [Sorry, never used to use SET]

Item 23: Consider Replacing Associative Containers with sorted vectors. [Good suggestion! ]

Item 24: prefer map :: insert to map :: operator [] When effect is a concern. [嘿, although I haven't thought about this problem, I have always used INSERT! Do you want to know that a little bit, but still cautious, I am afraid that Meyers will knock my head again ...

Item 25: Familiarize Yourself with the Nonstandard Hashed Containers. [Weak! I am still going to make up the class! ]

4. Iterators.

Item 26: prefer iterator to const_iterator, reverse_iterator, and const_reverse_iterator. [天 霹 3 3! Isn't it necessary to use const as possible? How do you add a next line? No, you have to tell me ...] Item 27: Use distance and advance to communication const_iterators to itrators. [二 和]

Item 28: Understand how to use a reverse_iterator's base iterator. [More Concept is unclear, Reverse_Iterator also has Base Iterator? Go to check books]

Item 29: Consider istreambuf_iterators for character by character infut. [, Worth studying]

5. Algorithms.

Item 30: make Sure Destination Ranges Are Big Enough. [It should be understandable! ]

Item 31: KNOW Your Sorting Options. [In principle, understand]

Item 32: Follow Remove-Like Algorithms by Erase if you real want to remove something. [Oh, you can understand! ]

Item 33: BE WARY of Remove-Like Algorithms on Containers of Pointers. This is really a problem that needs to be vigilant]

Item 34: Note Which Algorithms Expect sorted Ranges. [Not clear ...]

Item 35: Implement Simple Case-INSENSITIVE STRING COMPARISONS VIA Mismatch or Lexicographical_Compare. [Not clear ...]

Item 36: use not1 and remove_copy_if to perform a coupy_if. [Previously in Comp.lang.c . Moderated story on this clause is very exciting! Scott Meyers and Matt Austern are accidentally planted on this issue, and finally Bjarne Stroustrup is a hammer sound. After the graduation papers have changed, he will hear it. ]

Item 37: Use Accumulate or for_each to summarize sequences [Music Hist]

6. Functors, Functor Classes, Functions, etc.

Item 38: Design functor classes for pass-by-value. [Concept is a bit confused]

Item 39: make predicates pure functions. [天 霹雳 4, Stroustrup doesn't mean that functor can produce more efficient inline code? Why is Predications to excerey? I want to say it. ]

Item 40: make functor classes adaptable. [This problem is related to the terms 36. It seems that Meyers really excavated many treasures from Copy_IF's lessons] Item 41: Understand The Reason for PTR_FUN, MEM_FUN, AND MEM_FUN_REF. [Surface It is Know, but I can't think of them, explain that there is no Understand]

Item 42: Make Sure Less Means Operator <. [I have never thought about this problem]

7. Programming with the STL.

Item 43: Prefer Algorithm Calls to Hand-Written Loops. [I have never been so like this, but I don't know what other truths don't have COOL.

Item 44: Prefer Member Functions to Algorithms with The Same Names. [Can't be a sunny day, but it is also very unexpected, I have been using the pure algorithms to operate Contain as a glory]

Item 45: Distinguish Among Count, Find, Binary_Search, Lower_Bound, Upper_Bound, and Equal_Range. [It seems to be aware of one or two]

Item 46: Consider Function Objects INSTEAD OF FUNCTIONS AS Algorithm Parameters. [This is not contradictory with the terms 39? ]

Item 47: Avoid Producing Write-Only Code. [Don't understand]

Item 48: always #include the properties.

Item 49: Learn to Decipher STL-Related Compiler Diagnostics. [What is easy, especially VC]

Item 50: familiarize yourself with stl-corrected web site. [I know, I don't satisfy me]

转载请注明原文地址:https://www.9cbs.com/read-308.html

New Post(0)