polarours/Cppuccino
About
Cppuccino is a compact C++ tutorial and reference repository covering modern C++ features, value categories, references, and move semantics. Includes hands-on examples and clear explanations for real-world development.
Learning & EducationWhat you can do
- std-print: Type-safe formatted output
- deducing-this: C++23 explicit object parameter
- zip-range: Parallel iteration
- generator-pipeline: Lazy std::generator pipelines with early-exit propagation
Measured star growth
- in 24h
- Collecting history
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original
One C++ idea, in two languages, with runnable proof.
Documentation · Failure Atlas · Arcade · UB Camp · Labs · Actions · Contributing · MIT
Read an idea. Break it. Repair it. Prove it.
Start with Undefined Behavior · Open the Arcade · Fight the Dangling Pointer
Quick Stats
Counts are recomputed by tools/check_stats.py, so they stay in step with the repository.
| Category | Count |
|---|---|
| Documentation | 142 articles (71 en + 71 zh) |
| Pitfalls | 74 articles (37 en + 37 zh) |
| Examples | 161 runnable examples |
| Projects | 151 projects across 43 stages |
| Tests | 975 (all passing) |
Start Here
One cycle at a time: read an idea, inspect how it fails, then change code. If this is your first visit, use this order:
- Read the Roadmap Overview.
- Pick one topic track from the concept docs.
- Read one related pitfall article.
- Finish by touching code in an example or project.
Want the shortest path through failure modes? The UB Training Camp runs four bosses in order: lifetime → containers → concurrency → ownership. Each stop is read → reproduce → repair → prove. The final Proof Gate asks three questions per boss; only a 3/3 pass stamps the proof and completes the camp.
No toolchain at hand? Open the repo in
GitHub Codespaces.
The devcontainer ships GCC 15, clang, CMake
and Python; run tools/run_all_checks.sh inside it.
The published site is at polarours.github.io/Cppuccino.
Suggested Entry Points
Ownership and lifetime
- Read: Ownership - Starting from Here, Ownership and Lifetime, RAII and Exception Safety
- Failure mode: Dangling Pointer
- Code: ownership-and-lifetime.cpp
References, move semantics, and value categories
Object model and deeper semantics
Roadmap Overview
The Mastery Roadmap is a staged path through the material — an index, not a syllabus to finish.
| Stages | Theme | Projects |
|---|---|---|
| 1–7 | C++ Foundations to Advanced | 35 |
| 8–27 | Design Patterns (GoF 23 + Specification) | 61 |
| 28–31 | Architecture Patterns | 12 |
| 32–33 | Concurrency Patterns | 7 |
| 34 | C++ Specific Patterns (CRTP, SFINAE, Variadic) | 4 |
| 35 | Memory Patterns | 4 |
| 36 | Modern C++ (Coroutines, Ranges, Concepts) | 3 |
| 37 | Error Handling Patterns | 4 |
| 38 | Testing Patterns | 4 |
| 39 | Content Enhancement (Parser / Diff Tools) | 3 |
| 40 | C++23 Features | 4 |
| 41 | Capstone (HTTP Framework, Router, Template Engine) | 3 |
| 42 | Performance Patterns | 3 |
| 43 | Toolchain Patterns (CMake, CI/CD, Package Manager) | 3 |
Repository Map
Four kinds of material, cross-linked so an idea can be read, tested, and then used.
Documentation
- docs/en and docs/中文版: Concept-focused essays, usually one idea per document
- pitfalls/en and pitfalls/中文版: Common mistakes, invalid assumptions, and review-oriented notes
- Project API references: Glossary, Chat Server, Simple Database, Task Scheduler, Connection Pool
Tooling
See tools/README.md for what each check does and why, and CHANGELOG.md for the short list of notable changes.
- tools/run_all_checks.sh: one entry point for every repository check, the same one CI runs
- tools/check_docs.py: verifies that every document is written in the right language, and that the English and Chinese halves agree on their heading skeleton and code
- tools/check_links.py:
verifies that every relative link and
#anchorstill resolves - tools/check_doc_examples.py: assembles the complete example of every document, compiles it and runs it
- tools/check_examples.py:
compiles every standalone file in
examples/, using the build command its own header declares - tools/check_stats.py: verifies that the statistics in the READMEs still match the repository
- tools/build_all_projects.py: configures, builds and tests every project in the roadmap
tools/run_all_checks.sh # documentation checks
tools/run_all_checks.sh --full # and every project build
Examples
- examples, indexed in examples/README.md:
161 runnable code samples covering:
- Core concepts: ownership, move semantics, smart pointers, RAII
- Modern C++: lambda, constexpr, structured bindings, ranges
- C++20: concepts, ranges, span, format, coroutines
- C++23: fold expressions, CRTP, SFINAE, type traits
- Pitfall reproductions: one runnable example for every pitfall article
Projects
Beginner · Stage 1
Stage 1: Beginner
- student-management/v1: Basic student management system
- student-management/v2: Improved version with better I/O and tests
- student-management/v3: Borrowing parameters with std::string_view
Intermediate · Stage 2
Stage 2: Intermediate
- key-value-store: Complete key-value store with protocol, server, client, and concurrency
- tiny-http-server: HTTP server with routing and thread pool
- copy-move-demo: Copy/move semantics with observable constructors
- reference-binding-demo: Reference binding and lifetime extension rules
- trie: Prefix tree with word/prefix counts
- union-find: Disjoint set union with path compression
- binary-heap: Array-backed heap with bottom-up heapify
Advanced · Stage 3
Stage 3: Advanced
- thread-pool: Thread pool with futures and synchronization
- allocator: Fixed-block memory allocator with STL interface
- json-parser: Recursive descent JSON parser
- http-parser: HTTP request/response parser
- smart-pointer: Custom smart pointer implementation
- event-loop: Event loop with priority queue for timers
- static-init-demo: Static initialization order fiasco and the fix
- skip-list: Probabilistic ordered set with randomized levels
- csv-parser: RFC-4180 quoting rules with roundtrip formatting
- base64-codec: RFC 4648 encode/decode with strict padding validation
More practice · Stages 4–7
Stages 4–7: More Practice
- simple-db: File-based key-value database
- chat-server: Multi-client chat server
- web-server: HTTP web server with static files
- mini-redis: In-memory KV store with RESP-style replies and lazy TTL
- task-scheduler: Priority/delayed/repeating task scheduler
- timer-wheel: O(1) tick-based timer scheduling
- blocking-queue: Bounded MPMC queue with dual condition variables
- lfu-cache: Least-frequently-used eviction with LRU tie-breaking
- bloom-filter: Probabilistic membership with double hashing
Design patterns · Stages 8–27
Stages 8–27: Design Patterns
- GoF 23 patterns: All 23 Gang-of-Four patterns + Specification
- Command pattern variants: command-history, command-logger, command-memento, command-router, command-snapshot, command-translator, command-validator
- Observer pattern variants: observer-bus, observer-buffer, observer-debouncer, observer-filter-chain, observer-mediator, observer-subscription, observer-throttler
- Strategy pattern variants: strategy-adapter, strategy-chain, strategy-combinator, strategy-decorator, strategy-evaluator, strategy-factory, strategy-pipeline, strategy-resolver
- rate-limiter: Token bucket, fixed window, and sliding window algorithms
Architecture · Stages 28–31
Stages 28–31: Architecture Patterns
- mvc-pattern: Model-View-Controller architecture
- repository-pattern: Data access abstraction
- cqrs-pattern: Command Query Responsibility Segregation
- event-sourcing: Event-based state management and replay
- circuit-breaker: Fault tolerance pattern
- middleware-pipeline: Chained request/response processing
- service-locator: Centralized service registry
- unit-of-work: Transaction-like change tracking
- active-record: ORM pattern
- type-object: Runtime type system
- delegation: Behavior delegation
- balking: Guard-check pattern
Concurrency · Stages 32–33
Stages 32–33: Concurrency Patterns
- guarded-suspension: Wait for condition before proceeding
- producer-consumer: Bounded buffer with thread-safe push/pop
- double-buffer: Smooth data transition
- read-write-lock: Shared/exclusive locking
- lock-free-queue: Wait-free queue
- thread-pool-advanced: Task-based thread pool with futures
- actor-mailbox: Bounded mailbox with a single-consumer actor loop
Idioms, memory, modern C++ · Stages 34–38
Stages 34–38: C++, Memory, Modern C++, Error, Testing
- crtp-pattern: Curiously Recurring Template Pattern
- sfinae-pattern: Compile-time dispatch
- varargs-pattern: Variadic templates
- memory-pool: Pre-allocated block pool
- arena-allocator: Bump allocator
- slab-allocator: Size-classified cache
- coroutine-pattern: C++20 coroutines
- ranges-pattern: Range pipelines
- concepts-pattern: C++20 Concepts
- result-type: Type-safe error handling
- error-code: Enum-based error reporting
- expected-pattern: Value-or-error with monadic ops
- mock-objects: Test doubles
- test-fixture: Reusable test setup
- parameterized-tests: Data-driven tests
- type-erasure: Hand-rolled std::function-style wrapper (Concept/Holder)
- allocation-tracker: Process-wide allocation counters and counting allocator
- error-category: Custom std::error_code category mapped to std::errc
- golden-file-testing: Snapshot assertions with line diffs and UPDATE_GOLDEN flow
Content tools · Stage 39
Stage 39: Content Enhancement
- markdown-parser: Block-level markdown parsing with inline link extraction
- link-checker: Relative link validation with lexical path normalization
- text-diff: LCS line diff with unified-style rendering
C++23 · Stage 40
Stage 40: C++23 Features
- std-print: Type-safe formatted output
- deducing-this: C++23 explicit object parameter
- zip-range: Parallel iteration
- generator-pipeline: Lazy std::generator pipelines with early-exit propagation
Capstone · Stage 41
Stage 41: Capstone Project
- mini-http-framework: Complete HTTP framework combining 10 design patterns
- http-router: Method+path routing with :param extraction
- template-engine: Mustache-like sections with context chaining
Performance · Stage 42
Stage 42: Performance Patterns
- cache-friendly: AoS vs SoA data layout for cache performance
- simd-pattern: Manual SIMD-style vectorization
- memory-alignment: Cache-line alignment and aligned allocation
Toolchain · Stage 43
Stage 43: Toolchain Patterns
- cmake-pattern: Programmatic CMakeLists.txt generation
- package-manager: Dependency resolution and package management
- ci-cd-pattern: Pipeline pattern for build/test/deploy workflows
Other
- tinyshell: Unix shell with job control, signal handling, and variable expansion
How To Use This Repo
- Read by topic if you want a concise explanation of one C++ idea.
- Read by roadmap if you want a more structured learning path.
- Use the pitfalls folder as a review checklist when writing or reviewing code.
- Jump between docs and examples when you want the semantic explanation and the code sample together.
- Build the projects to practice applying concepts in real code.
Building Projects
Most projects use CMake. To build and test any project:
cd cpp-mastery-roadmap/<stage>/<project>
cmake -S . -B build -DBUILD_TESTING=ON
cmake --build build
ctest --test-dir build --output-on-failure
Some projects require C++20 or C++23 — check the CMakeLists.txt for CMAKE_CXX_STANDARD.
Project Philosophy
- One document should focus on one central idea.
- Content should stay concise, technically grounded, and reviewable.
- Explanation matters more than prescription.
- Ownership, lifetime, semantics, and tradeoffs matter more than folklore.
Contributing
See CONTRIBUTING.md.
Technical corrections, simplifications, better examples, and thoughtful counterexamples are especially useful contributions.
Community
Explore related projects
Loading…
