Effective Modern C++ by Scott Meyers

(www.oreilly.com) Effective Modern C++[Book]   website

ROAM_REFS: https://www.oreilly.com/library/view/effective-modern-c/9781491908419/
  • Effective Modern C++

Released

Publisher(s): O'Reilly Media, Inc.

ISBN: None

Read it now on the O'Reilly learning platform with a 10-day free trial.

O'Reilly members get unlimited access to books, live events, courses curated by job role, and more from O'Reilly and nearly 200 top publishers.

Start your free trial

** Book description

None

Show and hide more

** Table of contents

  1. Copyright/Revision History
  2. From the Publisher
    1. Using Code Examples
    2. Safari® Books Online
    3. How to Contact Us
  3. Acknowledgments
  4. Introduction
    1. Terminology and Conventions
    2. Reporting Bugs and Suggesting Improvements
  5. 1. Deducing Types
    1. Item 1: Understand template type deduction.
      1. Case 1: ParamType is a Reference or Pointer, but not a Universal Reference
      2. Case 2: ParamType is a Universal Reference
      3. Case 3: ParamType is Neither a Pointer nor a Reference
      4. Array Arguments
      5. Function Arguments
    2. Item 2: Understand auto type deduction.
    3. Item 3: Understand decltype.
    4. Item 4: Know how to view deduced types.
      1. IDE Editors
      2. Compiler Diagnostics
      3. Runtime Output
  6. 2. auto
    1. Item 5: Prefer auto to explicit type declarations.
    2. Item 6: Use the explicitly typed initializer idiom when auto deduces undesired types.
  7. 3. Moving to Modern C++
    1. Item 7: Distinguish between () and {} when creating objects.
    2. Item 8: Prefer nullptr to 0 and NULL.
    3. Item 9: Prefer alias declarations to typedefs.
    4. Item 10: Prefer scoped enums to unscoped enums.
    5. Item 11: Prefer deleted functions to private undefined ones.
    6. Item 12: Declare overriding functions override.
    7. Item 13: Prefer constiterators to iterators.
    8. Item 14: Declare functions noexcept if they won’t emit exceptions.
    9. Item 15: Use constexpr whenever possible.
    10. Item 16: Make const member functions thread safe.
    11. Item 17: Understand special member function generation.
  8. 4. Smart Pointers
    1. Item 18: Use std::uniqueptr for exclusive-ownership resource management.
    2. Item 19: Use std::sharedptr for shared-ownership resource management.
    3. Item 20: Use std::weakptr for std::sharedptr-like pointers that can dangle.
    4. Item 21: Prefer std::makeunique and std::makeshared to direct use of new.
    5. Item 22: When using the Pimpl Idiom, define special member functions in the implementation file.
  9. 5. Rvalue References, Move Semantics, and Perfect Forwarding
    1. Item 23: Understand std::move and std::forward.
    2. Item 24: Distinguish universal references from rvalue references.
    3. Item 25: Use std::move on rvalue references, std::forward on universal references.
    4. Item 26: Avoid overloading on universal references.
    5. Item 27: Familiarize yourself with alternatives to overloading on universal references.
      1. Abandon overloading
      2. Pass by const T&
      3. Pass by value
      4. Use Tag dispatch
      5. Constraining templates that take universal references
      6. Trade-offs
    6. Item 28: Understand reference collapsing.
    7. Item 29: Assume that move operations are not present, not cheap, and not used.
    8. Item 30: Familiarize yourself with perfect forwarding failure cases.
      1. Braced initializers
      2. 0 or NULL as null pointers
      3. Declaration-only integral static const and constexpr data members
      4. Overloaded function names and template names
      5. Bitfields
      6. Upshot
  10. 6. Lambda Expressions
    1. Item 31: Avoid default capture modes.
    2. Item 32: Use init capture to move objects into closures.
    3. Item 33: Use decltype on auto&& parameters to std::forward them.
    4. Item 34: Prefer lambdas to std::bind.
  11. 7. The Concurrency API
    1. Item 35: Prefer task-based programming to thread-based.
    2. Item 36: Specify std::launch::async if asynchronicity is essential.
    3. Item 37: Make std::threads unjoinable on all paths.
    4. Item 38: Be aware of varying thread handle destructor behavior.
    5. Item 39: Consider void futures for one-shot event communication.
    6. Item 40: Use std::atomic for concurrency, volatile for special memory.
  12. 8. Tweaks
    1. Item 41: Consider pass by value for copyable parameters that are cheap to move and always copied.
    2. Item 42: Consider emplacement instead of insertion.
  13. Index

(www.aristeia.com) Scott Meyers: Effective Modern C++   website

ROAM_REFS: https://www.aristeia.com/EMC++.html
  • Scott Meyers Training Courses: Effective Modern C++

Truly understanding C++11 and C++14 requires more than just familiarizing yourself with

auto
type declarations, move semantics, lambda expressions, concurrency support, etc. You also need to learn how to use those features effectively so that your software is correct, efficient, maintainable, and portable. That's where this seminar comes in. It describes how to write truly great software using C++11 and C++14—i.e. using modern C++.

This course is based on Scott's best-selling Effective Modern C++. All attendees will receive a copy of this book.

** Course Highlights

Participants will gain:

  • Familiarity with how best practices in "old" C++ programming (i.e., C++98) change for modern C++.
  • Awareness of the often-subtle performance implications of modern C++ features and techniques.
  • An understanding of the relationships among
    std::move
    ,
    std::forward
    , rvalue references, and universal references.
  • Techniques for writing clear, correct, effective lambda expressions.
  • Insights into the pros and cons of braced initialization,
    noexcept
    specifications, perfect forwarding, and smart pointer
    make
    functions.

** Who Should Attend

Systems designers, programmers, and technical managers involved in the design, implementation, and maintenance of libraries and applications using C++11 and C++14. Participants should be familiar with the fundamental concepts introduced by C++11 (e.g., move semantics, multithreading, lambda expressions, smart pointers, etc.), but expertise is not required. (One way to acquire the appropriate background is through Scott's more introductory course, An Overview of the New C++ (C++11/14)).

** Format

Lecture and question/answer. There are no hands-on exercises, but participants are welcome — encouraged! — to bring computers to experiment with the material as it is presented.

** Length

Four full days (six to seven lecture hours per day).

** Detailed Topic Outline

  • Preliminaries
    • Distinguish lvalues and rvalues.
    • Understand type deduction.
      • (
        auto
        -related) template type deduction
      • auto
        type deduction
      • Observing deduced types
      • decltype
        type deduction
      • Function return type deduction
    • Understand
      std::move
      and
      std::forward
      .
  • Moving to Modern C++
    • Prefer
      auto
      to explicit types when declaring objects.
    • Remember that
      auto
      +
      { =/=expr=/
      }= ⇒
      std::initializer_list
      .
    • Distinguish
      ()
      and
      {}
      when creating objects.
    • Prefer
      nullptr
      to
      0
      and
      NULL
      .
    • Prefer scoped enums to unscoped enums.
    • Prefer deleted functions to private undefined ones.
    • Declare overriding functions
      override
      .
    • Declare functions
      noexcept
      if they won't emit exceptions.
    • Use
      constexpr
      whenever possible.
    • Make
      const
      member functions thread-safe.
  • Smart Pointers
    • Use
      std::unique_ptr
      for exclusive-ownership resource management.
    • Use
      std::shared_ptr
      for shared-ownership resource management.
    • Prefer
      std::make_unique
      and
      std::make_shared
      to direct use of
      new
      .
  • Rvalue References, Move Semantics, and Perfect Forwarding
    • Distinguish universal references from rvalue references.
    • Pass and return rvalue references via
      std::move
      , universal references via
      std::forward
      .
    • Avoid overloading on universal references.
    • Understand reference collapsing.
    • Assume that move operations are not present, not cheap, and not used.
    • Familiarize yourself with perfect forwarding failure cases.
  • Lambda Expressions
    • Avoid default capture modes.
    • Use init capture to move objects into closures.
    • Prefer lambdas to
      std::bind
      .
  • The Concurrency API
    • Make =std::thread=s unjoinable on all paths.
    • Use
      std::launch::async
      with
      std::async
      if asynchronicity is essential.
    • Be aware of varying thread handle destructor behavior.
    • Create tasks, not threads.
    • Consider
      void
      futures for one-shot event communication.
  • Miscellaneous
    • Consider emplacement instead of insertion.
  • Resources for Further Information

For more information on this course, contact Scott directly.

Local Graph

org-roam 83d08aeb-973b-4c3e-8aed-97e40d44878f (www.reddit.com) Modern C++ book reco... c724183c-b996-49d0-8095-0dfd5f8500f2 Effective Modern C++ by Scott Meyers 83d08aeb-973b-4c3e-8aed-97e40d44878f->c724183c-b996-49d0-8095-0dfd5f8500f2