BackgroundCpp

Modernes C++

This page is the starting point for my blog Modernes C++. A simple overview of my existing and upcoming posts.

This overview serves two purposes. At first, the structure gives you in one view an overview, which posts are already written and how you can find them. At second, I give you an outline of all posts, which will be written. I will successively refine the outline to make the future of this post transparent. This purpose is a more challenging task for me.

BackgroundCpp

Multithreading in modern C++

C++ memory model

    1. Overview
    2. Atomic data types
      1. std::atomic_flag
      2. std::atomic
      3. std::atomic
    3. Synchronization and ordering constraints
    4. The different C++ memory models
      1. Sequential consistency
        1. Theory
        2. Practice
      2. Acquire-release semantic
        1. Synchronization and ordering constraints
        2. Transitivity
        3. The special case std::memory_order_consume
        4. The typical error
      3. Wait and Sleep
    5. Fences
      1. Memory barriers
      2. Acquire- and release memory barriers
    6. Algorithms
      1. Blocking and non-blocking algorithms
      2. ABA – A is not the same as A

The threading interface

  1. Threads
    1. Creation
    2. Lifetime
    3. Arguments
    4. Sharing data
      1. Risks
      2. Prefer Locks to Mutexes
      3. Reader-Writer locks
      4. Safe initialization
  2. Thread-local data
  3. Condition variables
  4. Tasks
    1. std::async
    2. std::packaged_task
    3. std::promise and std::future
    4. The special futures std::async
  5. Condition variables versus tasks for the synchronization of threads
  6. Challenges
    1. Data races versus race conditions
    2. Malicious data races
    3. Blocking and non-blocking algorithms

Multithreading with C++17 and C++20

  1. An overview
    1. Parallel algorithm of the Standard Template Library
    2. Atomic smart pointers
    3. std::future extensions
    4. Latches and barriers
    5. Coroutines
    6. Transactional memory
    7. Task blocks
    8. Executors
    9. Unified Futures
    10. std:::jthread

Application of multithreading

  1. The time library
    1. Overview
    2. Time point
    3. Time duration
    4. Clock
    5. Wait and Sleep
  2. Ongoing optimization with CppMem
    1. Context of ongoing optimization
    2. Introduction to CppMem
    3. Non-atomic variables
    4. Locks
    5. Sequential consistency
    6. Acquire-release semantic
    7. Acquire-release semantic with a data race
    8. Relaxed semantic
    9. volatile
  3. Singleton
    1. Thread safe initialization of a singleton
  4. Calculating the sum of a std::vector
    1. Single threaded
    2. Multithreaded with shared variables
    3. Multithreaded with minimal synchronization
    4. My conclusion
  5. The Dining Philosophers Problem
    1. Dining Philosophers Problem I
    2. Dining Philosophers Problem II
    3. Dining Philosophers Problem III

Embedded programming with C++

High safety requirements

  1. C++11
    1. Automatic type deduction with auto
    2. Prevent narrowing with  {} initialization
    3. Guarantees at compile time with static_assert and the type-traits library
      1. static_assert
      2. Continuously improvement- An introductory example to the type-traits library
      3. Check types
      4. Compare and modify types
    4. User-defined literals
      1. Type safe calculation with user-defined literals
      2. Raw and cooked
    5. Strongly-Typed Enumerations
    6. override and final
    7. The null pointer constant nullptr

Performance matters

  1. C++98
    1. inline
  2. C++11
    1. Constant expressions
      1. Variables and objects
      2. Functions
    2. Optimization with the type-traits library
    3. Multithreading interface
    4. C++ memory model
    5. Hashtables
      1. Overview
      2. A simple performance comparison
      3. Hash functions
      4. Buckets, capacity and, load factor
    6. Generalized PODs
    7. noexcept
  3. C++14
    1. constexpr functions

Careful handling of resources

  1. Overview
  2. Automatic memory management
    1. Smart pointers
      1. Memory and performance overhead
      2. std::unique_ptr
      3. std::shared_ptr
        1. std::shared_ptr
        2. Specialities
      4. std::weak_ptr
    2. The STL containers
      1. std::vector and std::string
      2. std::array
  3. C++ idioms
    1. Move semantic
      1. Copy versus Move semantics
      2. Two Nice Properties
    2. Perfect forwarding
    3. Garbage Collection – No Thanks
  4. Explicit memory management
    1. Overloading operator new and delete
      1. Part 1
      2. Part 2
    2. std::allocator
    3. Strategies for the allocation of memory
    4. Pros and cons of the various memory allocation strategies
    5. Memory Pool Allocators by Jonathan Müller

Functional programming with C++

  1. Overview
  2. Functional Feature in C++
    1. C++98
    2. TR1 and C++11
    3. Dispatch table and generic Lambdas
    4. C++17 and C++20
  3. The definition
  4. Characteristics of functional programming
    1. First-class functions
    2. Higher-order functions
    3. Immutable data
    4. Pure functions
    5. Recursion
    6. Manipulation of lists
    7. Lazy evaluation
      1. CRTP
      2. Expression templates
  5. Functional programming with C++17 and C++20
    1. Fold expressions
    2. The new ranges library
    3. Concepts
      1. Placeholders
    4. Monads in C++

Design Patterns and Architectural Patterns

  1. A First Overview
  2. Introduction
    1. The Advantages of Patterns
    2. The History of Patterns
    3. Classification of Design Patterns
    4. Classification of Patterns
  3. Terminology
    1. The Structure of Patterns
    2. About Algorithms, Frameworks, and Pattern Relations
    3. Anti-Patterns
  4. Design Patterns
    1. Creational Patterns
      1. Factory Method
        1. Factory Method
        2. Slicing and Ownership Semantics
      2. The Singleton
        1. The Singleton
        2. Pros and Cons
        3. The Alternatives: The Monostate Pattern and Dependency Injection
    2. Structural Patterns
      1. The Adapter Pattern
      2. The Bridge Pattern
      3. The Decorator Pattern
      4. The Composite Pattern
      5. The Facade Pattern
      6. The Proxy Pattern
    3. Behavioral Pattern
      1. The Visitor Pattern
      2. The Template Method
      3. The Strategy Pattern
  5. Idioms
    1. General
      1. The Copy-and-Swap Idiom
      2. Partial Function Application
      3. Argument-Dependent Lookup and the Hidden Friend Idiom
    2. Classes
      1. The Rule of Zero, or Six
      2. Regular Types
      3. Value Objects
      4. The Null Object Pattern
      5. The Iterator Protocol
      6. Covariant Return Type
    3. Polymorphism
      1. Idioms for Polymorphism and Templates
    4. Templates
      1. Idioms for Polymorphism and Templates
  6. Architectural Patterns
    1. How can you recognise a good software architecture? by Alexander Eisenhut
    2. Architectural Patterns
    3. Layers
    4. Pipes-and-Filters
    5. Broker
    6. Model-View-Controller
    7. Reactor
  7. Concurrency
    1. Concurrency Patterns
    2. Dealing with Sharing
    3. Dealing with Mutation: Locking
    4. Dealing with Mutation: The Thread-Safe Interface
    5. Dealing with Mutation: Guarded Suspension
    6. Active Object

C++17

  1. Core language
    1. More details
  2. Library
    1. std::byte
    2. std::filesystem
    3. std::string_view
    4. std::any, std::optional, and std::variant
    5. The New Algorithm of the STL
    6. Improved associative containers and uniform container access
    7. Parallel Algorithms of the STL with the GCC compiler
    8. Performance of the Parallel STL Algorithms
     

C++20

  1. The Next Big Thing: C++20
  2. Overview
    1. The Big Four
    2. The Core Language
    3. The Library
    4. Concurrency
  3. Details
    1. Concepts
      1. Two Extremes and the Rescue with Concepts
      2. The Details
      3. The Placeholder Syntax
      4. Syntactic Sugar
      5. What we don’t get
      6. Predefined Concepts
      7. Define Concepts
      8. Define Concepts (Logical Combination of other Concepts or Compile-Time Predicates)
      9. Defining Concepts with Requires Expressions
      10. Using Requires Expressions in C++20 as a Standalone Feature
      11. Define the Concepts Equal and Ordering
      12. Define the Concepts Regular and SemiRegular
      13. Check Types with Concepts – The Motivation
      14. Check Types with Concepts
      15. Concepts in C++20: An Evolution or a Revolution? 
    2. Ranges Library
      1. The Ranges Library
      2. Functional Pattern with the Ranges Library
      3. The Ranges Library in C++20: More Details
      4. Projections with Ranges
      5. Sentinels and Concepts with Ranges Algorithms
      6. Improved Iterators with Ranges
      7. Pythonic with the Ranges Library
      8. Pythons range Function, the Second
      9. Pythons map Function
    3. Coroutines
      1. A First Overview
      2. More Details
      3. An Infinite Data Stream with Coroutines
      4. Thread Synchronization with Coroutines
      5. cppcoro
        1. Coroutines with cppcoro
        2. Powerful coroutines with cppcoro
        3. Thread Pools with cppcoro
      6. co_return:
        1. Implementing Simple Futures with Coroutines
        2. Lazy Futures with Coroutines
        3. Executing a Future in a Separate Thread
      7. co_yield:
        1. An Infinite Data Stream with Coroutines
        2. A Generic Data Stream with Coroutines
      8. co_await
        1. Starting Jobs with Coroutines
        2. Automatically Resuming a Job with Coroutines on a Separate Thread
    4. Modules
      1. The Advantages of Modules
      2. A Simple math Modul
      3. Module Interface Unit and Module Implementation Unit
      4. Structure Modules
      5. Open Questions to Modules
      6. Private Module Fragment and Header Units
    5. The Core Language
      1. The Three-Way Comparison Operator
        1. The Three-Way Comparison Operator
        2. More Details to the Spaceship Operator
        3. Optimized Comparision with the Spaceship Operator
      2. Designated Initializers
      3. consteval and constinit
      4. Solving the Static Initialization Order Fiasco
      5. VariousTemplate Improvements with C++20
      6. More Powerful Lambdas with C++20
      7. More Lambda Features with C++20
      8. New Attributes with C++20
      9. volatile and other Small Improvements
    6. The Library
      1. std::span in C++20: Bounds-Safe Views for Sequences of Objects
      2. constexpr std::vector and std::string in C++20
      3. More Convenience Functions for Containers with C++20
      4. std::format
        1. The Basics
        2. Extend std::format for User-Defined Types
      5. More and More Utilities
      6. Calendar and Time-Zone
        1. Time of Day
        2. Calendar Date
        3. Handling Calendar Dates
        4. Time-Zones
      7. Safe Comparison of Integrals
      8. Feature Testing
      9. Bit Manipulation
    7. Concurrency
      1. Atomics
        1. References
        2. Synchronization with Atomics
        3. Performance Comparison of Condition Variables and Atomics
        4. Barriers and Atomic Smart Pointers
      2. Semaphores
      3. Latches
      4. Barriers
      5. Cooperative Interruption of a Thread
      6. std::jthread
      7. Synchronized Output Streams

C++23

  1. Range Improvements with C++23

C++ Core Guidelines

  1. Two highly valuable resources
  2. Why do we need guidelines for modern C++?
  3. The C++ Core Guidelines:
    1. The Philosophy
    2. Interfaces I
    3. Interfaces II
    4. Guideline Support Library
    5. Functions
      1. Definitions
      2. Parameters: Syntax
      3. Parameters: Semantic
    6. Classes
      1. General rules
      2. The Rule of Zero, Five, or Six
      3. Destructors
      4. Constructors
      5. Copy and Move
      6. Comparison, swap, and hash
      7. Function objects and Lambdas
      8. Hierarchies
        1. General rules
        2. Special rules I
        3. Special rules II
        4. Accessing Objects
      9. Overloading
        1. Overloading and Overload Operators I
        2. Overloading and Overload Operators II
      10. Unions
    7. Enums
    8. Resources
      1. General Rules
      2. Allocation and Deallocation of Memory
      3. Smart Pointers
      4. Passing Smart Pointers
    9. Expressions and Statements
      1. Declarations 
      2. Declarations and Initialisations
      3. More Rules for Declarations
      4. Expressions
      5. Expressions (Pointers)
      6. Conversions and Casts
      7. Rules about Don’ts (std::move and slicing)
      8. Rules for Statements
      9. To Switch or not to Switch, that is the Question
      10. More about Control Structures
      11. Arithmetic Rules
    10. Performance
      1. Rules about Performance
      2. More Rules about Performance
      3. The Remaining Rules about Performance
    11. Concurrency and Parallelism
      1. Rules about Concurrency and Parallelism
      2. More Rules about Concurrency and Parallelism
      3. Tools to Validate Concurrent-Code
      4. Sharing Data between Threads
      5. Taking Care of your Child
      6. More Traps in the Concurrency
      7. Be Aware of the Traps of Condition Variables
      8. Concurrency and lock-free Programming
      9. The Resolution of the Riddle
      10. The Remaining Rules of lock-free Programming
    12. Error Handling
      1. Rules for Error Handling
      2. A Short Detour to Contracts in C++20
      3. The noexcept Specifier and Operator
      4. Rules about Exception Handling
      5. finally in C++
      6. goto considered Evil
    13. Constants and Immutability
    14. Templates and Generic Programming
      1. Rules for Templates and Generic Programming
      2. Type Erasure
      3. Type Erasure with Templates
      4. Better Specific or Generic?
      5. Usage of Concepts
      6. Definition of Concepts
      7. Definition of Concepts 2
      8. Pass Function Objects as Operations
      9. Template Interfaces
      10. Regular and SemiRegular Types
      11. Surprises with Argument-Dependent Lookup
      12. Template Definitions
      13. Ordering of User-Defined Types
      14. Templates and Hierarchies
      15. Rules for Variadic Templates
      16. Rules for Template Metaprogramming
      17. Programming at Compile Time
      18. Programming at Compile Time with the Type-Traits
      19. Programming at Compile Time with the Type-Traits (The Second)
      20. Programming at Compile Time with constexpr
      21. Other Template Rules
      22. Surprise Includes with Function Template Specialisation
      23. Templates: Misconceptions and Surprises
      24. Types, Non-Types, and Templates as Template Parameters
    15. C-Style Programming
      1. Mixing C with C++
    16. Source
      1. Source Files
      2. The Remaining Rules about Source Files
      3. Modules
      4. More Details to Modules
    17. The Standard Library
      1. The Standard Library
      2. std::array and std::vector are your Friends
      3. More special Friends with std::map and std::unordered_map
      4. Avoid Bounds Errors
      5. Rules for Strings
      6. IOStreams
      7. In- and Output with Streams
      8. Improved Performance with Iostreams
      9. The Regular Expression Library
      10. More Rules about the Regular Expression Library
      11. When RAII breaks
    18. Supporting Sections
      1. Architectural Ideas
      2. Non-Rules and Myths
        1. More Non-Rules and Myths
        2. Myths of My Blog Readers
        3. More Myths of My Blog Readers
      3. Profiles
        1. Type Safety
        2. Type Safety by Design
        3. Bounds Safety
        4. Lifetime Safety and Checking the Rules
      4. Naming and Layout Rules

Templates

  1. First Steps
  2. Basics
    1. Function Templates
      1. Function Templates
      2. More Details: Explicit Template Arguments and Concepts
    2. Class Templates
      1. Class Templates
      2. Surprises Included: Inheritance and Member Functions of Class Templates
    3. Alias Templates and Template Parameters
    4. Template Arguments
      1. Template Arguments
      2. Template Argument Deduction of Class Templates
    5. Template Specialization
      1. Template Specialization
      2. More Details about Class Templates
      3. Full Specialization of Function Templates
  3. Details
    1. Template Instantiation
    2. Variadic Templates and Fold Expressions
      1. Variadic Templates or the Power of Three Dots
      2. More about Variadic Templates …
      3. From Variadic Templates to Fold Expressions
      4. Smart Tricks with Parameter Packs and Fold Expressions
      5. Visiting a std::variant with the Overload Pattern
    3. The Special Friendship of Templates
    4. Dependent Names
  4. Techniques
    1. Automatic Return Type
      1. Automatic Return Type (C++98)
      2. Automatic Return Type (C++11/14/20)
    2. Template Metaprogramming
      1. How it All Started
      2. How it Works
      3. Hybrid Programming
    3. Type-Traits Library
      1. Type Checks
      2. Type Comparisons
      3. std::is_base_of
      4. Correctness
      5. Performance
    4. constexpr
      1. constexpr Functions
      2. constexpr and consteval Functions in C++20
    5. constexpr if
  5. Design
    1. Dynamic versus Static Polymorphism
    2. CRTP
      1. More about Dynamic versus Static Polymorphism
      2. Mixins
    3. Avoiding Temporaries with Expression Templates
    4. Policy
    5. Traits and Tag Dispatching
    6. A std::advance Implementation based on C++98, C++11, and C++20
    7. Type Erasure

Review

  1. Clean C++

News

  1. No New New
  2. CppCon 2018
  3. Meeting Embedded and Meeting C++ 2018    
  4. Compiler Explorer, PVS-Studio, and Terrible Simple Bugs
  5. Quo Vadis – Modernes C++

Tools

  1. C++ Insights
    1. Implicit Conversions
    2. Type Deduction
    3. Template Instantiation
    4. Variadic Templates
    5. Lambdas
 
 

 

 

Thanks a lot to my Patreon Supporters: Matt Braun, Roman Postanciuc, Tobias Zindl, G Prvulovic, Reinhold Dröge, Abernitzke, Frank Grimm, Sakib, Broeserl, António Pina, Sergey Agafyin, Андрей Бурмистров, Jake, GS, Lawton Shoemake, Jozo Leko, John Breland, Venkat Nandam, Jose Francisco, Douglas Tinkham, Kuchlong Kuchlong, Robert Blanch, Truels Wissneth, Mario Luoni, Friedrich Huber, lennonli, Pramod Tikare Muralidhara, Peter Ware, Daniel Hufschläger, Alessandro Pezzato, Bob Perry, Satish Vangipuram, Andi Ireland, Richard Ohnemus, Michael Dunsky, Leo Goodstadt, John Wiederhirn, Yacob Cohen-Arazi, Florian Tischler, Robin Furness, Michael Young, Holger Detering, Bernd Mühlhaus, Stephen Kelley, Kyle Dean, Tusar Palauri, Juan Dent, George Liao, Daniel Ceperley, Jon T Hess, Stephen Totten, Wolfgang Fütterer, Matthias Grün, Phillip Diekmann, Ben Atakora, Ann Shatoff, Rob North, Bhavith C Achar, Marco Parri Empoli, Philipp Lenk, Charles-Jianye Chen, Keith Jeffery, Matt Godbolt, and Honey Sukesan.

Thanks, in particular, to Jon Hess, Lakshman, Christian Wittenhorst, Sherhy Pyton, Dendi Suhubdy, Sudhakar Belagurusamy, Richard Sargeant, Rusty Fleming, John Nebel, Mipko, Alicja Kaminska, Slavko Radman, and David Poole.

My special thanks to Embarcadero
My special thanks to PVS-Studio
My special thanks to Tipi.build 
My special thanks to Take Up Code
My special thanks to SHAVEDYAKS

Modernes C++ GmbH

Modernes C++ Mentoring (English)

Do you want to stay informed about my mentoring programs? Subscribe Here

Rainer Grimm
Yalovastraße 20
72108 Rottenburg

Mobil: +49 176 5506 5086
Mail: schulung@ModernesCpp.de
Mentoring: www.ModernesCpp.org

Modernes C++ Mentoring,

Rainer D 6 P2 500x500

 

Rainer D 6 P2 500x500Modernes C++ Mentoring

  • "Fundamentals for C++ Professionals" (open)
  • "Design Patterns and Architectural Patterns with C++" (open)
  • "C++20: Get the Details" (open)
  • "Concurrency with Modern C++" (open)
  • "Generic Programming (Templates) with C++": October 2024
  • "Embedded Programming with Modern C++": October 2024
  • "Clean Code: Best Practices for Modern C++": March 2025
  • Do you want to stay informed: Subscribe.

     

     

     

    0 replies

    Leave a Reply

    Want to join the discussion?
    Feel free to contribute!

    Leave a Reply

    Your email address will not be published. Required fields are marked *