GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - behnamasadi/cpp_tutorials: This repository contains my C++ snippets code on C++ concepts/ idioms, optimized C++, modern C++ and advance C++

BranchesTags
Open more actions menu

Latest commit

 

History

607 Commits
607 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.trunk
.trunk
 
 
.vscode
.vscode
 
 
docs
docs
 
 
src
src
 
 
.appveyor.yml
.appveyor.yml
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
BUILDING.md
BUILDING.md
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CMakePresets.json
CMakePresets.json
 
 
Dockerfile
Dockerfile
 
 
Doxyfile
Doxyfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

C++

CI
Ubuntu 24.04 (Docker) Linux GCC/Clang macOS Windows AppVeyor Docs Links CodeQL OpenSSF Scorecard

Stack
C++20 CMake Docker Doxygen Platforms

Repository
License GitHub Release Last commit Commit activity Contributors Issues Pull requests Top language Code size Repo size Stars Forks

This repository contains my C++ snippets on C++ concepts/idioms, optimized C++, modern C++ and advanced C++. It includes snippets for using third-party libraries to parse CSV, YAML, and JSON files, an example of code benchmarking with Google Benchmark, and a tutorial on using CMake to build and export your project.

Building

See BUILDING.md for CMake configuration, Docker usage (including GUI apps), and VSCode setup.

C++ Tutorials

Language Essentials

  • Data Types, Numerical Limits, Machine Epsilon, Precision, std::nan
  • Data Type Conversions, Casting, Type Coercion
  • Static Casting, Dynamic Casting
  • Const, Constexpr, consteval, constinit, Mutable
  • Immutable Objects
  • Decay
  • Enum
  • Functions, Function Objects, Function Pointer, Inline Functions
  • Extern Variables, Extern Functions
  • Lambda
  • Callable Objects, Callbacks
    • 1. Function Pointers
    • 2. Functor (Function Objects)
    • 3. std::function, std::placeholders, and std::bind
    • 4. Lambda Functions
    • 5. Member Function Pointers
    • 6. Signals and Slots
    • 7. std::invoke
    • 8. Packaged Tasks
    • 9. Coroutines
    • 10. Auto-generated operator() from a Captureless Lambda
  • References, Lvalue/Rvalue, reference_wrapper, std::ref / std::cref
  • Forwarding Reference
  • Move Semantics, Copy Constructor, Move Constructor, Assignment
  • Scope Resolution Operator
  • Scope and Life Cycle of Objects Returned by Functions
  • Nested Namespaces, Unnamed/Anonymous Namespaces
  • Macros
  • Literals
  • Numeral Systems in C++ Decimal, Binary, Octal, Hexadecimal
  • Big-endian, Little-endian
  • Bitset, Bit field, Bitwise Operations
  • Post-increment, Pre-increment, Unary plus
  • Ternary (One Line If)
  • Switch Case
  • Setting argc, argv
  • Simple Command Argument Parser
  • Assert
  • Attribute specifier sequence [[attribute-list]]
  • Register Keyword
  • Volatile Keyword
  • Signals
  • System Call
  • Three-way comparison <=> (C++20)
  • Structured binding declaration

Memory & Pointers

  • Heap and Stack, Memory Layout of C Programs
  • Dynamic Memory Allocation in C
  • Raw Pointers, Wild/Dangling, Memory Safety
  • Smart Pointers (unique_ptr, shared_ptr, weak_ptr, atomic smart pointers)
    • When to Use shared_ptr — 12 Concrete Patterns
    • Passing / Returning Smart Pointers to/from Functions
    • Smart Pointers as Class Members (PIMPL, getters, worked examples)
  • Memory Alignment (alignas, alignof, cache lines, Eigen)
  • Allocator
  • Track Memory Allocations (overriding new operator)

Containers, Iteration, Ranges

  • Containers
    • vector
    • lists
    • C arrays, std::array, std::span
    • set, map, pair, tuple, tie, unordered_map, multimap, unordered_set, multiset
    • Queue, Priority queue, deque, stack
  • Iterator, for_each loop, range-for loop, Loop optimization
  • Algorithms Library
  • Ranges and Views (C++20)
  • Execution Policies
  • Hash Functions, Hash Data Structure (Hash Table)
  • Comparator function objects: std::less, std::greater, std::not_fn (and the deprecated std::not1)

Strings, I/O, and Formatting

  • String C/C++, string_view, string literal, string conversion, ASCII, Unicode
  • String View
  • Basic IO Operation, Streams, Reading/Writing Files, cin, scanf, gets, getline, printf
  • std::format and std::print (C++20/23)
  • File System
  • Regex
  • Pseudo-random Number Generation, Distributions
  • Clock, Date, Time

Concurrency, Async, and Coroutines

  • Process, Inter Process Communication (IPC), Process Tree, Process Control Block (PCB)
  • Forking
  • Multithreading — Overview
    • Creating and Terminating Threads (function pointer, member function, functor, lambda)
    • Joining and Detaching Threads
    • std::jthread and std::stop_token (C++20)
    • Hardware Concurrency and Oversubscription
    • Thread Identity, Sleeping, Yielding
    • Race Conditions vs Data Races
    • Mutex (std::scoped_lock, lock_guard, unique_lock)
    • Deadlock and How to Avoid It
    • Semaphores (counting, binary)
    • Condition Variables and Spurious Wakeups
    • std::future, std::async, std::promise, std::packaged_task
    • std::atomic, Memory Ordering, ABA Problem
    • Designing Thread-Safe Classes
  • Atomic Operations and Atomic Types
  • Coroutines (C++20)

Templates and Generics

  • Templates, Expression Templates
  • Concepts (C++20)
  • Template Specialization, Tag Dispatch
  • Variadic Templates Function
  • Parameter Pack Expansion ...
  • Substitution failure is not an error (SFINAE)
  • Template argument deduction
  • Type Traits
  • Type Erasure
  • Typedef, Type alias (using keyword)
  • type_dispatch, integral_constant, true/false type
  • Argument-dependent lookup (ADL)

Error Handling

  • errno and std::error_code
  • Exception Handling, noexcept
  • Return, Abort, Exit, Throw, Terminate
  • Stack Unwinding

Modules and Build

  • C++20 Modules
  • C++ Translation Units
  • Conditional Compilation From CMakeLists
  • Printing List of All Included Headers
  • fPIE (Position Independent Executable) and fPIC (Position Independent Code)

Misc Utilities

  • Optional, Variant, Any — when to use which
    • Optional
    • Variant and std::visit
  • Loading Classes Dynamically From Plugins
  • Lexical Analyzer
  • Tricky Questions
  • Undefined behavior, Unspecified and Implementation-Defined
  • Trivial, standard-layout, POD, and literal types

C++ Classes

  • Abstract Class Vs Interface
  • Cast Base Class to Derived / Derived to Base
  • Class Forward Declaration
  • Object Initialization & Static Lifetime
    • Constructor Member Initializer Lists — declaration-order rule, latent bugs (worked example: src/class/constructor_initialization_list.cpp)
    • Aggregate / Brace Initialization
    • Copy Initialization
    • Direct Initialization
    • Default Initialization
    • Value Initialization
    • Zero Initialization
    • Uniform / List Initialization (C++11)
    • In-Class Member Initializers
    • std::initializer_list vs aggregate init
    • Static Member Functions, Static Initialization Order Fiasco
  • Copy / Move semantics, Rule of 5, copy-and-swap, temporaries, shallow vs deep copy
  • Cyclic (Circular) Dependency
  • Default(=default), Deleted (=delete) Constructors
  • Diamond Problem Virtual Inheritance
  • Explicit Constructor, Converting Constructor
  • Friend Functions
  • Header Guard
  • Inheritance, Inheritance Prevention (final)
  • Multiple Inheritance Polymorphism
  • Operator Overloading
  • Object Slicing
  • Passing Arguments To Parent Constructor
  • Private Public Protected Inheritance
  • Protected Friend Class Function
  • Shadowing
  • Special Member Functions
  • Structs
  • Virtual functions, abstract classes, virtual destructor, vtable / vptr

Advanced C++ Concepts and Idioms

  • Buffer overflow
  • Curiously Recurring Template Pattern (CRTP)
  • Copy Elision, Return value optimization (RVO, NRVO)
  • Double Dispatch
  • Most Vexing Parse
  • Metaprogramming
  • Pointer to implementation (PIMPL) — see also smart_pointers_class_member.md §3
  • Return Type Resolver
  • Resource Acquisition Is Initialization (RAII)
  • Run-Time Type Information (RTTI)
  • Stack overflow

Optimizing C++

  • Optimizing C++ source files

Tooling and Debugging

  • Compiler Explorer (godbolt.org)
  • Sanitizers (ASan, TSan, UBSan, MSan, LSan)
  • Memory Error Detection with AddressSanitizer and Valgrind
  • Generating and Debugging Dump File
  • Static analysis and linting with clang-tidy
  • Running GitHub Actions locally with act (test CI before you push)

Data File Storage Parsing

  • CSV
  • YAML
  • JSON
  • XML

REST API, Microservices, and Communication Libraries

  • Monolithic Architecture vs REST API and Microservices
  • REST APIs / Webhooks with cURL (libcurl)
  • gRPC C++ (official)
  • WebSockets with IXWebSocket
  • WebRTC with libdatachannel
  • GraphQL with cppgraphqlgen
  • XML SOAP with tinyxml2 + cURL
  • REST API with crow
  • Mocking APIs with Mockoon

Event Streaming and Message Queuing

  • Apache Kafka
  • RabbitMQ (rabbitmq.com)

Logging

  • spdlog (github.com/gabime/spdlog)

Code Benchmarking and Profiling

  • Google Benchmark
  • Tracy Profiler (github.com/wolfpld/tracy)

C++ Package Managers

  • Conan (docs.conan.io)
  • vcpkg
  • Chocolatey
  • Winget

Documentation, Packaging, Versioning

  • Doxygen — API documentation, UML diagrams, GitHub Action integration
  • CPack Packaging
  • Semantic Versioning
  • Getting Version From Git in CMake
  • Getting Release Version From Git (check for update)

C++ Coding Standards and Style

  • Google C++ Style Guide
  • isocpp Coding Standards
  • Bjarne Stroustrup's C++ Style

C++ System Design

Principles and Foundations

  • SOLID Principles in C++
  • Design a Reusable Library
  • API and ABI Design for C++ Libraries (versioning, symbol visibility, stable ABI)
  • Exception Safety Guarantees (basic, strong, no-throw)
  • Error Handling Strategies and Fault Tolerance (error codes, exceptions, std::expected, tl::expected)
  • Dependency Injection and Inversion of Control
  • Resource Management Patterns (RAII, scope guards, unique_resource)

Design Patterns

  • Object-Oriented Design Patterns (Factory, Singleton, Observer, Strategy, Visitor, Decorator, Adapter)
  • Concurrency Patterns (Thread Pool, Producer-Consumer, Active Object, Reactor, Proactor)
    • Producer–Consumer: backpressure vs. drop
    • Latest-value (mailbox) buffer
    • Worked example: bounded queue vs. latest-value
    • Cross-process: ROS2 QoS mapping
  • Event-Driven Architecture and State Machines (HSM, boost::sml)
  • Pipeline and Dataflow Architectures

Memory and Performance

  • Memory Management Strategies (Pool, Arena, Slab, Bump/Linear Allocators)
  • Cache-Friendly Data Structures and Data-Oriented Design
  • False Sharing, Cache Line Padding, NUMA Awareness
  • Lock-Free Data Structures (SPSC/SPMC/MPMC, ring buffers, hazard pointers, RCU)
  • Branch Prediction, Prefetching, and SIMD
  • High-Performance Computing (HPC) Patterns (SPMD, fork-join, work stealing)

Architecture and Modularity

  • Plugin Architecture and Dynamic Loading
  • Modular Design with C++20 Modules and Build-System Architecture
  • Serialization and Deserialization (Protobuf, FlatBuffers, Cap'n Proto, MessagePack)
  • Inter-Process Communication and Shared Memory (mmap, Boost.Interprocess)
  • Configuration Management (compile-time vs runtime, feature flags)

Observability and Testability

  • Logging, Metrics, and Distributed Tracing (OpenTelemetry C++)
  • Testing Strategies (mocking, fuzzing, property-based, contract testing)
  • Designing for Testability (seams, dependency injection, fakes vs mocks)

Domain-Specific Architectures

  • Real-Time Systems Design (deadlines, priority inversion, deterministic latency)
  • Embedded Systems Design (no-heap, no-exceptions, freestanding C++)
  • Game Engine Architecture (ECS, scene graphs, frame pacing)
  • Distributed Systems Patterns in C++ (RPC, sharding, consensus, backpressure)

VSCode

  • tasks.json, settings.json, launch.json

About

This repository contains my C++ snippets code on C++ concepts/ idioms, optimized C++, modern C++ and advance C++

Topics

advance-cppcpp-code-profilingcpp-coding-standardscpp-conceptscpp-idiomscpp-package-managercpp-packaging-and-deploymentcpp-snippetscpp-style-guidedocumentation-with-doxygenmodern-cppoptimized-cppsoftware-versioning

Resources

Readme
BSD-3-Clause license
Activity

Stars

76 stars

Watchers

3 watching

Forks

17 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.