Effective Modern C++

42 Specific Ways to Improve Your Use of C++11 and C++14
 
 
O'Reilly (Verlag)
  • 1. Auflage
  • |
  • erschienen am 11. November 2014
  • |
  • 336 Seiten
 
E-Book | PDF mit Adobe-DRM | Systemvoraussetzungen
978-1-4919-0843-3 (ISBN)
 
Coming to grips with C++11 and C++14 is more than a matter of familiarizing yourself with the features they introduce (e.g., auto type declarations, move semantics, lambda expressions, and concurrency support). The challenge is learning to use those features effectivelyso that your software is correct, efficient, maintainable, and portable. Thats where this practical book comes in. It describes how to write truly great software using C++11 and C++14i.e. using modern C++.Topics include:The pros and cons of braced initialization, noexcept specifications, perfect forwarding, and smart pointer make functionsThe relationships among std::move, std::forward, rvalue references, and universal referencesTechniques for writing clear, correct, effective lambda expressionsHow std::atomic differs from volatile, how each should be used, and how they relate to C++'s concurrency APIHow best practices in &quote;old&quote; C++ programming (i.e., C++98) require revision for software development in modern C++Effective Modern C++ follows the proven guideline-based, example-driven format of Scott Meyers' earlier books, but covers entirely new material.&quote;After I learned the C++ basics, I then learned how to use C++ in production code from Meyer's series of Effective C++ books. Effective Modern C++ is the most important how-to book for advice on key guidelines, styles, and idioms to use modern C++ effectively and well. Don't own it yet? Buy this one. Now&quote;.-- Herb Sutter, Chair of ISO C++ Standards Committee and C++ Software Architect at Microsoft
  • Englisch
  • Sebastopol
  • |
  • USA
  • Windows
  • 3,06 MB
978-1-4919-0843-3 (9781491908433)
weitere Ausgaben werden ermittelt
  • Cover
  • Copyright/Revision History
  • Table of Contents
  • From the Publisher
  • Using Code Examples
  • O'Reilly Safari
  • How to Contact Us
  • Acknowledgments
  • Introduction
  • Terminology and Conventions
  • Reporting Bugs and Suggesting Improvements
  • Chapter 1. Deducing Types
  • Item 1: Understand template type deduction.
  • Case 1: ParamType is a Reference or Pointer, but not a Universal Reference
  • Case 2: ParamType is a Universal Reference
  • Case 3: ParamType is Neither a Pointer nor a Reference
  • Array Arguments
  • Function Arguments
  • Item 2: Understand auto type deduction.
  • Item 3: Understand decltype.
  • Item 4: Know how to view deduced types.
  • IDE Editors
  • Compiler Diagnostics
  • Runtime Output
  • Chapter 2. auto
  • Item 5: Prefer auto to explicit type declarations.
  • Item 6: Use the explicitly typed initializer idiom when auto deduces undesired types.
  • Chapter 3. Moving to Modern C++
  • Item 7: Distinguish between () and {} when creating objects.
  • Item 8: Prefer nullptr to 0 and NULL.
  • Item 9: Prefer alias declarations to typedefs.
  • Item 10: Prefer scoped enums to unscoped enums.
  • Item 11: Prefer deleted functions to private undefined ones.
  • Item 12: Declare overriding functions override.
  • Item 13: Prefer const_iterators to iterators.
  • Item 14: Declare functions noexcept if they won't emit exceptions.
  • Item 15: Use constexpr whenever possible.
  • Item 16: Make const member functions thread safe.
  • Item 17: Understand special member function generation.
  • Chapter 4. Smart Pointers
  • Item 18: Use std::unique_ptr for exclusive-ownership resource management.
  • Item 19: Use std::shared_ptr for shared-ownership resource management.
  • Item 20: Use std::weak_ptr for std::shared_ptr-like pointers that can dangle.
  • Item 21: Prefer std::make_unique and std::make_shared to direct use of new.
  • Item 22: When using the Pimpl Idiom, define special member functions in the implementation file.
  • Chapter 5. Rvalue References, Move Semantics, and Perfect Forwarding
  • Item 23: Understand std::move and std::forward.
  • Item 24: Distinguish universal references from rvalue references.
  • Item 25: Use std::move on rvalue references, std::forward on universal references.
  • Item 26: Avoid overloading on universal references.
  • Item 27: Familiarize yourself with alternatives to overloading on universal references.
  • Item 28: Understand reference collapsing.
  • Item 29: Assume that move operations are not present, not cheap, and not used.
  • Item 30: Familiarize yourself with perfect forwarding failure cases.
  • Chapter 6. Lambda Expressions
  • Item 31: Avoid default capture modes.
  • Item 32: Use init capture to move objects into closures.
  • Item 33: Use decltype on auto&& parameters to std::forward them.
  • Item 34: Prefer lambdas to std::bind.
  • Chapter 7. The Concurrency API
  • Item 35: Prefer task-based programming to thread-based.
  • Item 36: Specify std::launch::async if asynchronicity is essential.
  • Item 37: Make std::threads unjoinable on all paths.
  • Item 38: Be aware of varying thread handle destructor behavior.
  • Item 39: Consider void futures for one-shot event communication.
  • Item 40: Use std::atomic for concurrency, volatile for special memory.
  • Chapter 8. Tweaks
  • Item 41: Consider pass by value for copyable parameters that are cheap to move and always copied.
  • Item 42: Consider emplacement instead of insertion.
  • Index
  • About the Author
DNB DDC Sachgruppen

Dateiformat: PDF
Kopierschutz: Adobe-DRM (Digital Rights Management)

Systemvoraussetzungen:

Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).

Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions (siehe E-Book Hilfe).

E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)

Das Dateiformat PDF zeigt auf jeder Hardware eine Buchseite stets identisch an. Daher ist eine PDF auch für ein komplexes Layout geeignet, wie es bei Lehr- und Fachbüchern verwendet wird (Bilder, Tabellen, Spalten, Fußnoten). Bei kleinen Displays von E-Readern oder Smartphones sind PDF leider eher nervig, weil zu viel Scrollen notwendig ist. Mit Adobe-DRM wird hier ein "harter" Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.

Bitte beachten Sie bei der Verwendung der Lese-Software Adobe Digital Editions: wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!

Weitere Informationen finden Sie in unserer E-Book Hilfe.


Download (sofort verfügbar)

51,09 €
inkl. 7% MwSt.
Download / Einzel-Lizenz
PDF mit Adobe-DRM
siehe Systemvoraussetzungen
E-Book bestellen