richelbilderbeek / ProjectRichelBilderbeek

Richel Bilderbeek's C++ work, before splitting it up
http://richelbilderbeek.nl/
6 stars 3 forks source link

Add Scott Meyer's advice #216

Closed richelbilderbeek closed 9 years ago

richelbilderbeek commented 10 years ago

From http://cppandbeyond.com/2012/04/16/session-topic-initial-thoughts-on-effective-c11:

    Prefer auto to Explicit Type Declarations
    Distinguish () and {} When Creating Objects
    Remember that auto + { expr } == std::initializer_list
    Prefer non-member begin/end to member versions
    Declare std::thread Members Last in Classes
    Be Wary of Default Capture Modes in Lambdas Escaping Member Functions
    Prefer Emplacement to Insertion
    Pass std::launch::async if Asynchronicity is Essential
    Minimize use of Weak Atomics
    Distinguish Rvalue References from Universal References
    Assume that move operations are neither present nor cheap
    Prefer Lambdas over Binders
    Prefer Lambdas over Variadic Arguments to Threading Functions
    Be Wary of Oversubscription
    Apply std::forward when Passing Universal References
    Prefer std::array to Built-in Arrays
    Use std::make_shared Whenever Possible
    Prefer Pass-by-Reference-to-const to Pass-by-Value for std::shared_ptrs
    Pass by Value if You’ll Copy Your Parameter
    Reserve noexcept for Functions with Wide Interfaces
    For Copyable Types, View Move as an Optimization of Copy
    Prefer enum classes to enums
    Prefer nullptr to NULL and 0
    Distinguish among std::enable_if, static_assert, and =delete
richelbilderbeek commented 10 years ago

Todo:

    Distinguish () and {} When Creating Objects
    Be Wary of Default Capture Modes in Lambdas Escaping Member Functions
    Prefer Emplacement to Insertion
    Pass std::launch::async if Asynchronicity is Essential
    Minimize use of Weak Atomics
    Assume that move operations are neither present nor cheap
    Prefer Lambdas over Variadic Arguments to Threading Functions
    Be Wary of Oversubscription
    Pass by Value if You’ll Copy Your Parameter
    For Copyable Types, View Move as an Optimization of Copy
richelbilderbeek commented 9 years ago

Need his book to do so better.

richelbilderbeek commented 9 years ago

This issue was moved to richelbilderbeek/RichelbilderbeekNl#3