正常
Complete Beginner Tutorial
This directory contains a complete beginner tutorial for the OnceCallback component, consisting of 13 articles that cover the full learning path from reviewing basic C++ features to component implementation and testing.
Prerequisites
First, master the core C++ features required for OnceCallback:
OnceCallback Prerequisite Cheat Sheet: Review of C++11/14/17 Core FeaturesOnceCallback Prerequisites (1): Function Types and Template Partial SpecializationOnceCallback Prerequisites (2): std::invoke and Uniform Callable ProtocolsOnceCallback Prerequisites (3): Advanced Lambda FeaturesOnceCallback Prerequisites (4): Concepts and requires ConstraintsOnceCallback Prerequisites (5): std::move_only_function (C++23)OnceCallback Prerequisites (6): Deducing this (C++23)
Hands-on Practice
After completing the prerequisites, we will start implementing OnceCallback:
OnceCallback in Action (1): Motivation and API DesignOnceCallback in Action (2): Core Skeleton SetupOnceCallback in Action (3): bind_once ImplementationOnceCallback in Action (4): Cancellation Token DesignOnceCallback in Action (5): then Chaining CompositionOnceCallback in Action (6): Testing and Performance Comparison
Companion Code
The standalone C++ example code covered in the prerequisite chapters has been extracted into minimal, compilable projects located at:
text
code/volumn_codes/vol9/full_tutorial_codes/chrome_design/| Example | Topic | Source Article | Min C++ Standard |
|---|---|---|---|
01_move_semantics.cpp | Move semantics, perfect forwarding, variadic templates | pre-00 | C++17 |
02_smart_pointers.cpp | unique_ptr, shared_ptr | pre-00 | C++17 |
03_atomic_memory_order.cpp | atomic, memory_order, enum class | pre-00 | C++17 |
04_lambda_basics.cpp | Capture modes, generic lambda, [[nodiscard]] | pre-00 | C++17 |
05_lambda_advanced.cpp | mutable lambda, init capture, C++17/C++20 bind | pre-03 | C++20 |
06_type_traits.cpp | type traits, if constexpr, decltype(auto), ref-qualifier | pre-00 | C++17 |
07_function_type_specialization.cpp | Function types, FuncTraits, primary template + partial specialization | pre-01 | C++17 |
08_invoke.cpp | std::invoke, std::invoke_result_t | pre-02 | C++17 |
09_concepts_requires.cpp | concept, requires, not_the_same_t, template constructor hijacking | pre-04 | C++20 |
10_move_only_function.cpp | std::move_only_function ctor/move/empty check/SBO | pre-05 | C++23 |
11_deducing_this.cpp | deducing this deduction rules, lvalue interception | pre-06 | C++23 |
Build instructions:
bash
cd code/volumn_codes/vol9/full_tutorial_codes/chrome_design
mkdir build && cd build
cmake ..
make -j$(nproc)