Tagged articles
3 articles
Page 1 of 1
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.

Compile-timeTemplate MetaprogrammingZero-cost abstraction
0 likes · 10 min read
Unlock C++ Power: Master Template Metaprogramming for Zero‑Cost Abstractions
Tencent Cloud Developer
Tencent Cloud Developer
Nov 2, 2022 · Fundamentals

C++ Performance Traps: Hidden Costs of Abstraction and Compiler Optimization Pitfalls

Modern C++ performance suffers when seemingly harmless abstractions—such as virtual functions, hidden copies, non‑trivial destructors, overused std::shared_ptr, type‑erasing wrappers, std::variant/optional, and std::async—prevent inlining and efficient memory use, while patterns like std::move on returns, hidden destructors in tail recursion, and branchy loops thwart NRVO, tail‑call, and auto‑vectorization optimizations.

C++Compiler OptimizationNRVO
0 likes · 16 min read
C++ Performance Traps: Hidden Costs of Abstraction and Compiler Optimization Pitfalls