Tagged articles

Template Metaprogramming

7 articles · Page 1 of 1
Deepin Linux
Deepin Linux
Jun 23, 2026 · Fundamentals

How Type Traits Rescue a Broken C++ Object Pool and Enable Type‑Adaptive Pooling

The author recounts how a naïve generic C++ object pool caused data residue, construction failures, and incompatibility with primitive types, then demonstrates a refactored, thread‑safe pool that leverages compile‑time Type Traits, std::enable_if, and constexpr if to apply distinct creation, reset, and destruction logic for trivial, Clear‑able, and non‑trivial types, eliminating the earlier bugs.

C++Template MetaprogrammingThread Safety
0 likes · 11 min read
How Type Traits Rescue a Broken C++ Object Pool and Enable Type‑Adaptive Pooling
IT Services Circle
IT Services Circle
May 7, 2026 · Fundamentals

Beyond Static Polymorphism: 3 Practical CRTP Uses – Object Counting, Interface Injection, and Cloning

The article explains CRTP’s core mechanism—each template instantiation creates an independent type—and demonstrates three real‑world patterns (object counting, interface injection, and a type‑safe clone) with complete C++ code, pitfalls, and performance comparisons to virtual‑function alternatives.

C++CRTPClone Pattern
0 likes · 11 min read
Beyond Static Polymorphism: 3 Practical CRTP Uses – Object Counting, Interface Injection, and Cloning
IT Services Circle
IT Services Circle
Mar 8, 2026 · Fundamentals

Why C++17 Fold Expressions Turn Variadic Templates into One‑Liners

This article explains how C++17 fold expressions replace verbose recursive variadic template tricks with concise one‑line constructs, covering their four syntactic forms, practical examples such as summing, printing, compile‑time checks, and common pitfalls to avoid.

C++C++17Fold Expressions
0 likes · 14 min read
Why C++17 Fold Expressions Turn Variadic Templates into One‑Liners
php Courses
php Courses
Aug 28, 2025 · Fundamentals

Unlock C++ Power: Master Template Metaprogramming for Zero‑Cost Abstractions

Template Metaprogramming (TMP) leverages C++ templates to perform compile‑time calculations and code generation, offering zero‑cost abstractions, type safety, and performance gains, with examples like compile‑time factorials and type‑trait utilities, while modern C++ features such as constexpr and variable templates simplify its usage.

C++MetaprogrammingTemplate Metaprogramming
0 likes · 10 min read
Unlock C++ Power: Master Template Metaprogramming for Zero‑Cost Abstractions
Tencent Cloud Developer
Tencent Cloud Developer
Jun 20, 2022 · Fundamentals

Understanding C++ LINQ and Ranges Pipeline Implementation

The article explains how a C++ LINQ‑style pipeline, built on concepts like _Can_pipe and composable _Pipeline classes, provides lazy, type‑safe range operations using the pipe operator, serving as the foundation for the C++20 ranges library and future execution framework.

C++ LINQC++20 RangesFunctional Programming
0 likes · 10 min read
Understanding C++ LINQ and Ranges Pipeline Implementation
Tencent Cloud Developer
Tencent Cloud Developer
Feb 24, 2022 · Fundamentals

Understanding Property Registration and Runtime Access in a C++ Reflection Framework

The article dissects the Ponder C++ reflection library’s Property subsystem, explaining how registration via ClassBuilder creates property entries, how traits and ValueBinders map members to abstract Property objects, and how runtime Get/Set calls traverse templated binders to provide type‑safe, high‑performance access.

C++PropertyRuntime
0 likes · 16 min read
Understanding Property Registration and Runtime Access in a C++ Reflection Framework