$ show Light-City/CPlusPlusThings
C++ι£δΊδΊ (CPlusPlusThings) is a comprehensive Chinese C++ learning repository that aggregates code examples, tutorials, and practical exercises covering basic to advanced C++ topics. The repository is structured as a monolithic collection of self-contained C++ source files organized by topic areas including basic language features (const, static, virtual, pointers), modern C++ features (C++11/14/17), design patterns, STL source code analysis, concurrency, and coding idioms. The project uses Bazel as its build system and includes both Chinese and English documentation. The codebase primarily serves as an educational resource rather than a production application. Each topic area contains multiple .cpp files demonstrating specific C++ concepts through minimal, focused examples. The repository includes practical exercises organized as a 10-day practice series, key exercise collections, and analysis of STL internals like vector, list, hashtable, and rb_tree implementations. The design patterns section covers singleton (with multiple thread-safe variants), producer-consumer, and other classic patterns. The architecture follows a flat, topic-based organization where each directory represents a C++ concept or feature area. Most files are standalone examples that can be compiled independently using the provided Bazel BUILD files. The repository demonstrates moderate code quality with clear examples but limited production-grade error handling or comprehensive testing. The content appears to have been actively developed through 2019-2020 based on commit dates, with the last commit in May 2026 suggesting some ongoing maintenance.
The LLM identified 5 files worth highlighting for reuse:
A clean implementation of unique_ptr demonstrating modern C++ memory management patterns. Shows proper move semantics, template-based derived-to-base conversion, and the copy-and-swap idiom. The implementation is self-contained and could be extracted as a teaching tool for understanding RAII and smart pointer internals.
Demonstrates perfect forwarding with std::forward and reference collapsing rules. The code clearly shows the difference between std::move and std::forward, and how universal references work in template functions. This is a reusable example for understanding C++11 reference semantics.
Implements a SFINAE-based serialization system that detects whether a type has a serialize() method at compile time. Uses decltype and declval for expression SFINAE, with if constexpr for compile-time branching. This pattern is reusable for generic programming tasks requiring type capability detection.
Thread-safe singleton implementation using Double-Checked Locking Pattern (DCLP) with C++11 memory model. Includes a nested CGarbo class for automatic cleanup. This is a classic pattern for lazy initialization in multithreaded environments, though modern C++ prefers static local variables.
Implements a generic fmap function that applies a transformation to container elements. Demonstrates template template parameters, type decay, and result type computation. This functional programming pattern is reusable for any container transformation task.