← ClaudeAtlas

cpp-templates-conceptslisted

C++ generic and compile-time programming: concepts and requires-clauses with subsumption, if constexpr and folds, deducing this, CTAD and class-type NTTPs, constexpr/consteval/constinit, ranges and view-lifetime rules, C++26 static reflection, and keeping compile times under control. Load when writing or debugging templates, concepts, ranges pipelines or compile-time code.
rustcircle/c101 · ★ 0 · Data & Documents · score 65
Install: claude install-skill rustcircle/c101
# C++ templates, concepts and compile-time code Baseline: C++20 concepts and ranges everywhere; C++23 deducing `this`, `ranges::to`, `if consteval` where the toolchain has them; C++26 reflection only behind its macro. Versions that matter: | Feature | GCC | Clang | MSVC | Gate | |---|---|---|---|---| | deducing `this` (P0847) | 14 | 18 | 19.32 partial, 19.43 | `__cpp_explicit_this_parameter` | | range-for temporary lifetime (P2718) | 15 | 19 | 19.51 | `__cpp_range_based_for >= 202211L` | | `std::ranges::to` (P1206) | 14 partial, 15 (libstdc++) | 17 (libc++) | 19.34 | `__cpp_lib_ranges_to_container` | | pack indexing `Ts...[0]` (P2662) | 15 | 19 | - | `__cpp_pack_indexing` | | static reflection (P2996) + `template for` (P1306) | 16, `-std=c++26 -freflection` | upstreaming in progress; Bloomberg `clang-p2996` fork | - | `__cpp_impl_reflection`, `__cpp_lib_reflection` | Deep material: [ranges adaptors, availability and custom views](references/ranges-adaptors.md) | [C++26 reflection cookbook and fallbacks](references/reflection-cookbook.md) ## 1. Constrain every template Pick the weakest standard concept that admits the algorithm: | Requirement | Concept | |---|---| | arithmetic | `std::integral`, `std::signed_integral`, `std::unsigned_integral`, `std::floating_point` | | type relations | `std::same_as`, `std::derived_from`, `std::convertible_to`, `std::common_with` | | value semantics | `std::movable`, `std::copyable`, `std::semiregular`, `std::regular` | | comparison | `