Effective C++ Digital Collection: 140 Ways to Improve Your Programming [NOOK Book]

Overview

Scott Meyers’s seminal C++ books– Effective C++ , More Effective C++ , and Effective STL –have been immensely helpful to hundreds of thousands of C++ programmers. All three are finally available together in this eBook collection.

 

Effective C++ has been embraced by hundreds of thousands of programmers worldwide. The reason is clear: Scott Meyers’s practical approach to C++ describes the rules of thumb used by the experts to produce clear, correct, efficient code. The ...

See more details below
Effective C++ Digital Collection: 140 Ways to Improve Your Programming

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac

Want a NOOK? Explore Now

NOOK Book (eBook)
$54.99
BN.com price
(Save 42%)$95.99 List Price

Overview

Scott Meyers’s seminal C++ books– Effective C++ , More Effective C++ , and Effective STL –have been immensely helpful to hundreds of thousands of C++ programmers. All three are finally available together in this eBook collection.

 

Effective C++ has been embraced by hundreds of thousands of programmers worldwide. The reason is clear: Scott Meyers’s practical approach to C++ describes the rules of thumb used by the experts to produce clear, correct, efficient code. The book is organized around 55 specific guidelines, each of which describes a way to write better C++. Each is backed by concrete examples.

 

In More Effective C++, Meyers presents 35 ways to improve your programs and designs. Drawing on years of experience, Meyers explains how to write software that is more effective: more efficient, more robust, more consistent, more portable, and more reusable. In short, how to write C++ software that’s just plain better.

 

In Effective STL, Meyers goes beyond describing what's in the STL to show you how to use it. Each of the book’s 50 guidelines is backed by Meyers’s legendary analysis and incisive examples, so you’ll learn not only what to do, but also when to do it–and why.

 

Together in this collection, these books include the following important features:

  • Expert guidance on the design of effective classes, functions, templates, and inheritance hierarchies.
  • Applications of new “TR1” standard library functionality, along with comparisons to existing standard library components.
  • Insights into differences between C++ and other languages (e.g., Java, C#, C) that help developers from those languages assimilate “the C++ way” of doing things.
  • Proven methods for improving program efficiency, including incisive examinations of the time/space costs of C++ language features
  • Comprehensive descriptions of advanced techniques used by C++ experts, including placement new, virtual constructors, smart pointers, reference counting, proxy classes, and double-dispatching
  • Examples of the profound impact of exception handling on the structure and behavior of C++ classes and functions
  • Practical treatments of new language features, including bool, mutable, explicit, namespaces, member templates, the Standard Template Library, and more. If your compilers don’t yet support these features, Meyers shows you how to get the job done without them.
  • Advice on choosing among standard STL containers (like vector and list), nonstandard STL containers (like hash_set and hash_map), and non-STL containers (like bitset).
  • Techniques to maximize the efficiency of the STL and the programs that use it.
  • Insights into the behavior of iterators, function objects, and allocators, including things you should not do.
  • Guidance for the proper use of algorithms and member functions whose names are the same (e.g., find), but whose actions differ in subtle (but important) ways.
  • Discussions of potential portability problems, including straightforward ways to avoid them.
Read More Show Less

Product Details

  • ISBN-13: 9780132979184
  • Publisher: Pearson Education
  • Publication date: 7/24/2012
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • Pages: 944
  • Sales rank: 603,115
  • File size: 53 MB
  • Note: This product may take a few minutes to download.

Meet the Author

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 is a founding member of 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.

Read More Show Less

Table of Contents

Effective C++

 

Introduction 1A

 

Chapter 1: Accustoming Yourself to C++ 11A

Item 1: View C++ as a federation of languages. 11A

Item 2: Prefer consts, enums, and inlines to #defines. 13A

Item 3: Use const whenever possible. 17A

Item 4: Make sure that objects are initialized before they’re used. 26A

 

Chapter 2: Constructors, Destructors, and Assignment Operators 34A

Item 5: Know what functions C++ silently writes and calls. 34A

Item 6: Explicitly disallow the use of compiler-generated functions you do not want. 37A

Item 7: Declare destructors virtual in polymorphic base classes. 40A

Item 8: Prevent exceptions from leaving destructors. 44A

Item 9: Never call virtual functions during construction or destruction. 48A

Item 10: Have assignment operators return a reference to *this. 52A

Item 11: Handle assignment to self in operator=. 53A

Item 12: Copy all parts of an object. 57A

 

Chapter 3: Resource Management 61A

Item 13: Use objects to manage resources. 61A

Item 14: Think carefully about copying behavior in resourcemanaging classes. 66A

Item 15: Provide access to raw resources in resourcemanaging classes. 69A

Item 16: Use the same form in corresponding uses of new and delete. 73A

Item 17: Store newed objects in smart pointers in standalone statements. 75A

 

Chapter 4: Designs and Declarations 78A

Item 18: Make interfaces easy to use correctly and hard to use incorrectly. 78A

Item 19: Treat class design as type design. 84A

Item 20: Prefer pass-by-reference-to-const to pass-by-value. 86A

Item 21: Don’t try to return a reference when you must return an object. 90A

Item 22: Declare data members private. 94A

Item 23: Prefer non-member non-friend functions to member functions. 98A

Item 24: Declare non-member functions when type conversions should apply to all parameters. 102A

Item 25: Consider support for a non-throwing swap. 106A

 

Chapter 5: Implementations 113A

Item 26: Postpone variable definitions as long as possible. 113A

Item 27: Minimize casting. 116A

Item 28: Avoid returning “handles” to object internals. 123A

Item 29: Strive for exception-safe code. 127A

Item 30: Understand the ins and outs of inlining. 134A

Item 31: Minimize compilation dependencies between files. 140A

 

Chapter 6: Inheritance and Object-Oriented Design 149A

Item 32: Make sure public inheritance models “is-a.” 150A

Item 33: Avoid hiding inherited names. 156A

Item 34: Differentiate between inheritance of interface and inheritance of implementation. 161A

Item 35: Consider alternatives to virtual functions. 169A

Item 36: Never redefine an inherited non-virtual function. 178A

Item 37: Never redefine a function’s inherited default parameter value. 180A

Item 38: Model “has-a” or “is-implemented-in-terms-of” through composition. 184A

Item 39: Use private inheritance judiciously. 187A

Item 40: Use multiple inheritance judiciously. 192A

 

Chapter 7: Templates and Generic Programming 199A

Item 41: Understand implicit interfaces and compile-time polymorphism. 199A

Item 42: Understand the two meanings of typename. 203A

Item 43: Know how to access names in templatized base classes. 207A

Item 44: Factor parameter-independent code out of templates. 212A

Item 45: Use member function templates to accept “all compatible types.” 218A

Item 46: Define non-member functions inside templates when type conversions are desired. 222A

Item 47: Use traits classes for information about types. 226A

Item 48: Be aware of template metaprogramming. 233A

 

Chapter 8: Customizing new and delete 239A

Item 49: Understand the behavior of the new-handler. 240A

Item 50: Understand when it makes sense to replace new and delete. 247A

Item 51: Adhere to convention when writing new and delete. 252A

Item 52: Write placement delete if you write placement new. 256A

Chapter 9: Miscellany 262A

Item 53: Pay attention to compiler warnings. 262A

Item 54: Familiarize yourself with the standard library, including TR1. 263A

Item 55: Familiarize yourself with Boost. 269A

 

Appendix A: Beyond Effective C++ 273A

Appendix B: Item Mappings Between Second and Third Editions 277A

 

Index 280A

 

More Effective C++

 

Introduction 1B

 

Basics 9B

Item 1: Distinguish between pointers and references. 9B

Item 2: Prefer C++-style casts. 12B

Item 3: Never treat arrays polymorphically. 16B

Item 4: Avoid gratuitous default constructors. 19B

 

Operators 24B

Item 5: Be wary of user-defined conversion functions. 24B

Item 6: Distinguish between prefix and postfix forms of increment and decrement operators. 31B

Item 7: Never overload &&, , or ,. 35B

Item 8: Understand the different meanings of new and delete. 38B

 

Exceptions 44B

Item 9: Use destructors to prevent resource leaks. 45B

Item 10: Prevent resource leaks in constructors. 50B

Item 11: Prevent exceptions from leaving destructors. 58B

Item 12: Understand how throwing an exception differs from passing a parameter or calling a virtual function. 61B

Item 13: Catch exceptions by reference. 68B

Item 14: Use exception specifications judiciously. 72B

Item 15: Understand the costs of exception handling. 78B

 

Efficiency 81B

Item 16: Remember the 80-20 rule. 82B

Item 17: Consider using lazy evaluation. 85B

Item 18: Amortize the cost of expected computations. 93B

Item 19: Understand the origin of temporary objects. 98B

Item 20: Facilitate the return value optimization. 101B

Item 21: Overload to avoid implicit type conversions. 105B

Item 22: Consider using op= instead of stand-alone op. 107B

Item 23: Consider alternative libraries. 110B

Item 24: Understand the costs of virtual functions, multiple inheritance, virtual base classes, and RTTI. 113B

 

Techniques 123B

Item 25: Virtualizing constructors and non-member functions. 123B

Item 26: Limiting the number of objects of a class. 130B

Item 27: Requiring or prohibiting heap-based objects. 145B

Item 28: Smart pointers. 159B

Item 29: Reference counting. 183B

Item 30: Proxy classes. 213B

Item 31: Making functions virtual with respect to more than one object. 228B

 

Miscellany 252B

Item 32: Program in the future tense. 252B

Item 33: Make non-leaf classes abstract. 258B

Item 34: Understand how to combine C++ and C in the same program. 270B

Item 35: Familiarize yourself with the language standard. 277B

 

Recommended Reading 285B

An auto_ptr Implementation 291B

 

General Index 295B

Index of Example Classes, Functions, and Templates 313B

 

Effective STL

 

Introduction 1C

 

Chapter 1: Containers 11C

Item 1: Choose your containers with care. 11C

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

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

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

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

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

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

Item 8: Never create containers of auto_ptrs. 40C

Item 9: Choose carefully among erasing options. 43C

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

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

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

 

Chapter 2: vector and string 63C

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

Item 14: Use reserve to avoid unnecessary reallocations. 66C

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

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

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

Item 18: Avoid using vector<bool>. 79C

 

Chapter 3: Associative Containers 83C

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

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

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

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

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

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

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

 

Chapter 4: Iterators 116C

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

Item 27: Use distance and advance to convert a container’s const_iterators to iterators. 120C

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

Item 29: Consider istreambuf_iterators for character-bycharacter input. 126C

 

Chapter 5: Algorithms 128C

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

Item 31: Know your sorting options. 133C

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

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

Item 34: Note which algorithms expect sorted ranges. 146C

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

Item 36: Understand the proper implementation of copy_if. 154C

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

 

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

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

Item 39: Make predicates pure functions. 166C

Item 40: Make functor classes adaptable. 169C

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

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

 

Chapter 7: Programming with the STL 181C

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

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

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

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

Item 47: Avoid producing write-only code. 206C

Item 48: Always #include the proper headers. 209C

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

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

 

Bibliography 225C

Appendix A: Locales and Case-Insensitive String Comparisons 229C

Appendix B: Remarks on Microsoft’s STL Platforms 239C

 

Index 245C

Read More Show Less

Customer Reviews

Average Rating 3
( 1 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(1)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted September 30, 2012

    D

    G

    0 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)