π Documentation: https://gauravagarwalgarg.github.io/modern-cpp-playground/
π¦ Repository: GitHub
Production-quality Modern C++ learning & interview preparation repository for HFT, HPC, GPU, Systems, Networking, OS, Embedded, and Low-Latency engineering roles.
Starting fresh with C++? See the Learning Path below and the C++ Standards Evolution doc.
Preparing for interviews? Every file is self-contained, compilable, and annotated with interview relevance and day-to-day usage context.
Candidates preparing for:
- C++ Software Engineer roles at FAANG, trading firms, GPU companies
- Low-Latency / HFT roles (Citadel, Jump, Two Sigma, Jane Street, Optiver)
- High-Performance Computing roles (HPC clusters, scientific computing)
- GPU / Infrastructure roles (NVIDIA, AMD, graphics engines)
- Systems / Networking roles (kernel, drivers, protocols)
- Embedded C++ roles (automotive, IoT, RTOS)
- OS and Concurrency roles (scheduler, lock-free, memory model)
AModernCppPlayground/
βββ CMakeLists.txt # Root CMake build (auto-discovers all src/*.cpp)
β
βββ src/
β βββ modern_cpp/ # C++11/14/17/20 language features
β β βββ move_semantics.cpp
β β βββ smart_pointers.cpp
β β βββ templates_sfinae.cpp
β β βββ concepts.cpp
β β βββ constexpr_consteval.cpp
β β βββ lambdas.cpp
β β βββ raii.cpp
β β βββ rule_of_five.cpp
β β βββ optional_variant_any.cpp
β β βββ structured_bindings.cpp
β β βββ ranges.cpp
β β βββ crtp.cpp
β β βββ perfect_forwarding.cpp
β β βββ custom_allocator.cpp
β β βββ copy_elision.cpp
β β βββ noexcept.cpp
β β βββ practical/ # Day-to-day modern C++ patterns
β β βββ value_semantics.cpp # Regular types, spaceship operator
β β βββ compile_time_programming.cpp # constexpr, consteval, if constexpr
β β βββ raii_patterns.cpp # ScopeGuard, TimerGuard, C API wrappers
β β βββ error_handling.cpp # Result<T,E>, monadic chaining, optional
β β βββ type_traits_concepts.cpp # Custom concepts, constrained templates
β β
β βββ patterns/ # Design Patterns
β β βββ singleton.cpp # GoF: Meyer's singleton
β β βββ factory.cpp # GoF: Factory method
β β βββ abstract_factory.cpp # GoF: Abstract factory
β β βββ builder.cpp # GoF: Builder
β β βββ observer.cpp # GoF: Classic observer
β β βββ strategy.cpp # GoF: Strategy
β β βββ command.cpp # GoF: Command
β β βββ decorator.cpp # GoF: Decorator
β β βββ adapter.cpp # GoF: Adapter
β β βββ facade.cpp # GoF: Facade
β β βββ template_method.cpp # GoF: Template Method
β β βββ state.cpp # GoF: State
β β βββ visitor.cpp # GoF: Visitor
β β βββ chain_of_responsibility.cpp
β β βββ proxy.cpp # GoF: Caching/Logging proxy
β β βββ composite.cpp # GoF: File system tree
β β βββ flyweight.cpp # GoF: Shared state optimization
β β βββ memento.cpp # GoF: Undo/Redo history
β β βββ iterator.cpp # GoF: Custom ring buffer iterator
β β βββ mediator.cpp # GoF: Event bus
β β βββ software_design/ # β
Modern C++ Design Patterns
β β βββ type_erasure.cpp # The core pattern of modern C++
β β βββ external_polymorphism.cpp # Polymorphism without modifying types
β β βββ value_based_strategy.cpp # std::function strategy injection
β β βββ pimpl_idiom.cpp # Bridge/Pimpl for ABI stability
β β βββ strong_types.cpp # CRTP mixin for type safety
β β βββ small_buffer_optimization.cpp # SBO type erasure (no heap)
β β βββ prototype_pattern.cpp # Virtual clone() for deep copy
β β βββ modern_observer.cpp # Signal/slot with RAII connections
β β βββ compile_time_decorator.cpp# Zero-overhead template decoration
β β βββ runtime_decorator.cpp # Type-erased composable decorators
β β
β βββ concurrency/ # Threading, atomics, lock-free
β β βββ threads_basics.cpp
β β βββ mutex_condvar.cpp
β β βββ atomics.cpp
β β βββ memory_model.cpp
β β βββ lock_free_queue.cpp
β β βββ thread_pool.cpp
β β βββ producer_consumer.cpp
β β
β βββ solid/ # SOLID principles with code
β β βββ solid_principles.cpp
β β
β βββ systems/ # Industry domain code
β β βββ hft/ # HFT / Low-latency
β β β βββ order_book.cpp
β β β βββ market_data_handler.cpp
β β β βββ matching_engine.cpp
β β βββ networking/ # Sockets, protocols
β β β βββ tcp_server.cpp
β β β βββ epoll_server.cpp
β β βββ linux/ # Linux programming
β β β βββ signal_handling.cpp
β β β βββ mmap_shared_memory.cpp
β β βββ os/ # OS concepts
β β β βββ virtual_memory.cpp
β β β βββ scheduler_sim.cpp
β β βββ embedded/ # Embedded C++
β β β βββ state_machine.cpp
β β βββ hpc_gpu/ # HPC / GPU ecosystem
β β βββ simd_vectorization.cpp
β β
β βββ dsa/ # DSA patterns in C++
β β βββ two_pointers.cpp
β β βββ sliding_window.cpp
β β βββ binary_search_on_answer.cpp
β β βββ monotonic_stack.cpp
β β βββ union_find.cpp
β β βββ trie.cpp
β β βββ segment_tree.cpp
β β βββ topological_sort.cpp
β β βββ bit_manipulation.cpp
β β βββ dijkstra.cpp # Graph: shortest path
β β βββ kmp_string_matching.cpp # Strings: pattern matching
β β βββ backtracking_nqueens.cpp # Backtracking with pruning
β β βββ knapsack_01.cpp # DP: 0/1 knapsack
β β βββ longest_common_subsequence.cpp # DP: classic 2D
β β βββ merge_sort.cpp # Divide & conquer sort
β β
β βββ stl_like/ # Custom STL implementations
β βββ doubly_linked_list.cpp
β βββ hash_map.cpp
β βββ lru_cache.cpp
β βββ memory_pool.cpp
β βββ thread_safe_queue.cpp
β
βββ docs/ # Documentation
β βββ cpp-standards-evolution.md # β
C++98 β C++03 β C++11 β C++14 β C++17 β C++20 β C++23 β C++26
β βββ software-design-patterns.md # β
Modern C++ design patterns (Iglberger)
β βββ modern-cpp.md # Quick reference: features & interview frequency
β βββ design-patterns.md # GoF patterns in C++
β βββ solid-principles.md
β βββ hft-low-latency.md
β βββ networking.md
β βββ linux-programming.md
β βββ hpc-gpu.md
β βββ os-internals.md
β βββ embedded-cpp.md
β βββ dsa-patterns.md
β βββ concurrency.md
β βββ interview-roadmap.md
β
βββ tests/ # Test programs
βββ benchmarks/ # Performance benchmarks
βββ scripts/ # Build helpers
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
# Run any example (executable name = path with / replaced by _)
./bin/modern_cpp_move_semantics
./bin/modern_cpp_practical_value_semantics
./bin/patterns_software_design_type_erasure
./bin/systems_hft_order_book
./bin/dsa_monotonic_stack
./bin/stl_like_lru_cache| Area | Files | Interview Priority |
|---|---|---|
| Modern C++ Features | 16 + 5 practical | β β β β β |
| Software Design Patterns (NEW) | 10 | β β β β β |
| Concurrency & Lock-Free | 7 | β β β β β |
| GoF Design Patterns | 20 | β β β β β |
| SOLID Principles | 1 | β β β β β |
| HFT / Low-Latency | 3 | β β β β β |
| Networking | 2 | β β β β β |
| Linux Programming | 2 | β β β ββ |
| OS Internals | 2 | β β β ββ |
| Embedded | 1 | β β β ββ |
| HPC / GPU | 1 | β β β ββ |
| DSA Patterns | 15 | β β β β β |
| Custom STL | 5 | β β β β β |
Start here if you're new to C++ or coming from another language:
π Read: docs/cpp-standards-evolution.md (understand the timeline)
β
1οΈβ£ src/modern_cpp/raii.cpp β Foundation of C++ design
2οΈβ£ src/modern_cpp/smart_pointers.cpp β Memory management
3οΈβ£ src/modern_cpp/move_semantics.cpp β Efficiency
4οΈβ£ src/modern_cpp/lambdas.cpp β Modern style
5οΈβ£ src/modern_cpp/practical/value_semantics.cpp β How to think in C++
β
π Read: docs/modern-cpp.md (feature reference)
β
6οΈβ£ src/modern_cpp/templates_sfinae.cpp β Generic programming
7οΈβ£ src/modern_cpp/concepts.cpp β Modern constraints
8οΈβ£ src/modern_cpp/practical/compile_time_programming.cpp
9οΈβ£ src/modern_cpp/practical/error_handling.cpp
π src/modern_cpp/practical/type_traits_concepts.cpp
β
π Read: docs/software-design-patterns.md
β
1οΈβ£1οΈβ£ src/patterns/software_design/type_erasure.cpp β THE pattern
1οΈβ£2οΈβ£ src/patterns/software_design/external_polymorphism.cpp
1οΈβ£3οΈβ£ src/patterns/software_design/pimpl_idiom.cpp
1οΈβ£4οΈβ£ src/patterns/software_design/strong_types.cpp
Focus on what interviewers actually ask:
| Week 1 | Week 2 | Week 3 |
|---|---|---|
| Move semantics | Type erasure | Lock-free queue |
| Smart pointers | SBO optimization | Thread pool |
| Perfect forwarding | Pimpl idiom | Memory model |
| Rule of Five | Strong types | Atomics |
| RAII patterns | External polymorphism | HFT systems |
Critical Path:
move_semantics β custom_allocator β memory_pool β
small_buffer_optimization β lock_free_queue β
order_book β matching_engine β simd_vectorization
- C++20 (builds with GCC 12+, Clang 14+, MSVC 19.30+)
- Every file is self-contained with
main()+ assertions - Comments explain why, not just what
- Each file header states: topic, interview relevance, day-to-day application
- Complexity annotations on all functions
- No raw
new/deleteunless demonstrating RAII contrast - Adapted code from external sources is attributed and re-styled for consistency
The following repos were used as source material and adapted to fit this repository's structure and style:
| Repo | What we took | Where it lives now |
|---|---|---|
cpp_software_design (Iglberger) |
Type erasure, external polymorphism, SBO, strong types | src/patterns/software_design/ |
design-patterns-cpp |
GoF pattern structure verification | src/patterns/ |
C-Plus-Plus (algorithms) |
DSA reference implementations | src/dsa/, src/stl_like/ |
cp-algorithms-aux |
Competitive programming algorithms | Reference only |
MIT