Valid STL Chinese version: 50 practical experience using STL (two-color)

Source: Internet
Author: User
Author: (US) Meyers, S .) translator: Pan aimin Chen Ming Kai Hong Publishing House: Electronic Industry Publishing House ISBN: 9787121201257 mounting Date: May 2013 publication date: Opening: 16 open page: 220 versions: 1-1 category: more about computers, more about computers, more about illegal STL, Chinese version: 50 experiences with effectively using STL (two-color), Introduction to computer books, C ++ standard template library (STL), is revolutionary, but it is not easy to learn how to use well. Scott Meyers (author of Objective C ++ and more objective C ++) reveals some of the key rules concluded by experts, both the practice that experts always adopt and the practice that experts always avoid. With these rules, STL programmers can use STL to the maximum extent. About 50 guiding principles, the simplified STL Chinese version: 50 practical STL experiences (two colors) provides a thorough analysis and profound examples, so that readers can learn what to do, when to do it, and why. Introduction 11 containers 9 1st articles: carefully select the container type. 2nd: do not try to write code independent of the container type. Article 12: ensure that the objects in the container are copied correctly and efficiently. 16 4th: Call empty instead of checking whether size () is 0. Article 18: The interval member function takes precedence over the corresponding single-element member function. Article 20: Beware of the most annoying analysis mechanism of the C ++ compiler. Article 26: if the container contains a pointer created through the new operation, delete the pointer before the container object structure. Article 28: do not create a container object containing auto_ptr. 32 9th items: carefully select the method for deleting elements. 34. Article 34: Understand the conventions and restrictions of the Allocation Sub-item (Allocator. Article 38: Understand the rational usage of user-defined assignment subtasks. Article 44: do not rely on the thread security of STL containers. 472 vector and string. 51 13th: vector and string take precedence over the dynamically allocated array. Article 51: reserve is used to avoid unnecessary reallocation. 15th: note the diversity of string implementations. Article 55: Learn How to pass vector and string data to the old API. 60. 17th items: use the "swap technique" to remove excess capacity. 18th: Avoid using vector [bool]. 643 associate container 67 19th: understand the differences between equality and equivalence. 67 20th: Specify the comparison type for the associated containers containing pointers. 71. 21st items: always make the comparison function return false in equivalent conditions. 22nd: do not directly modify the keys in set or Multiset. 23rd: consider replacing the associated container with a sorted vector. 82 24th: When efficiency is critical, exercise caution when selecting between map: operator [] and map: insert. Article 87: familiar with non-standard hash containers. 914 26th iterators: iterator takes precedence over const_iterator, reverse_iterator, and const_reverse_iterator. 95 27th: use distance and advance to convert the const_iterator of the container to iterator. 98 28th: correctly understand the usage of iterator generated by the Base () member function of reverse_iterator. 101: Use istreambuf_iterator for character-by-character input. 1035 algorithms. 106 30th: ensure that the target range is large enough. Article 107: Learn about various sorting-related options. 110: If you need to delete an element, you need to call erase after removing this type of algorithm. 115 33rd: Be careful when using the Remove Algorithm for containers containing pointers. Article 118: learn which algorithms require the use of sorting intervals as parameters. Article 121: mismatch or lexicographical_compare is used to perform simple case-insensitive string comparison. Article 124: Understand the correct implementation of the copy_if algorithm. 128 37th: Use accumulate or for_each for Interval statistics. 1306 function Child, function subclass, function and others 135: design function subclass based on the principle of passing values. Article 135: Make sure that the discriminant is "pure function ". Article 138: If a class is a function Child, it should be made accessible. 141 Article 41st: Understanding ptr_fun, mem_fun and mem_fun_ref. Article 145: Make sure that less [T] and operator [have the same semantics. 1487 use STL 152 in programs 43rd: algorithm calls take precedence over handwritten loops. Article 21: Container member functions take precedence over algorithms with the same name. 159: correctly differentiate count, find, binary_search, lower_bound, upper_bound, and pai_range. Article 161: Consider using function objects rather than functions as parameters of STL algorithms. 168: avoid generating "Write-only" code. 172: always include the correct header file. Article 175: Learn to analyze compiler diagnostic information related to STL. Article 21: familiar with STL-related web sites. 183 bibliography 189 comparison between region A and case-insensitive strings in Appendix A 193 appendix B's description of Microsoft's STL platform 202 Source: China Interactive publishing network

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.