正常
OnceCallback: callback design lessons from Chromium
This directory systematically teaches the design of a modern C++ callback system by implementing a Chromium-style OnceCallback component. The content is split into two learning paths:
Complete beginner tutorial (full/)
Aimed at readers starting from zero, it opens with a review of fundamental C++ features and gradually leads up to a complete component implementation.
Prerequisites (7 articles):
OnceCallback prerequisite cheat sheet: a review of C++11/14/17 core featuresOnceCallback prerequisite (I): function types and template partial specializationOnceCallback prerequisite (II): std::invoke and the uniform calling protocolOnceCallback prerequisite (III): advanced lambda featuresOnceCallback prerequisite (IV): Concepts and requires constraintsOnceCallback prerequisite (V): std::move_only_function (C++23)OnceCallback prerequisite (VI): Deducing this (C++23)
Hands-on practice (6 articles):
OnceCallback hands-on (I): motivation and API designOnceCallback hands-on (II): building the core skeletonOnceCallback hands-on (III): implementing bind_onceOnceCallback hands-on (IV): designing the cancellation tokenOnceCallback hands-on (V): chaining with thenOnceCallback hands-on (VI): tests and performance comparison
Advanced design guide (hands_on/)
Aimed at readers who already have C++ template experience, it is a fast-paced walkthrough of the design motivation, the implementation strategy, and the test verification.