Tag: metaprogramming
9 posts
-
C++26 Reflection Basics: the ^^ Operator, std::meta::info and template for
The actual syntax of C++26 static reflection (P2996): the ^^ operator and std::meta::info, identifier_of, nonstatic_data_members_of with access_context, [: :] splices, template for with define_static_array, [[=...]] annotations, compiler support, and C++20 alternatives.
-
TypeScript Decorators: Class, Method, Property and Parameter Decorators, Factories and reflect-metadata
TypeScript decorators: experimentalDecorators, class/method/property decorators, decorator factories, logging, validation, authorization.
-
Python Decorators: Writing @decorator Functions, Decorator Factories and functools.wraps
Write Python decorators for logging, caching, auth and retries, build decorator factories that take arguments, and keep metadata with functools.wraps.
-
Type Erasure in C++: How std::function and std::any Work, and Building Your Own
How std::function and std::any hide concrete types behind one interface, building your own copyable type-erased wrapper, and its cost versus virtuals.
-
How <type_traits> Works: Type Queries, enable_if, void_t Detection and if constexpr
How C++ type traits actually work under the hood: SFINAE with enable_if, the void_t detection idiom, why if constexpr discards untaken branches, and how traits relate to C++20 concepts.
-
Tag Dispatching in C++: Overload Selection by Tag Types, vs if constexpr and Concepts
How tag dispatching picks a C++ overload at compile time with empty tag types, why iterator tags inherit from each other, and when if constexpr fits better.
-
SFINAE in C++: enable_if, Expression SFINAE and When to Switch to Concepts
How SFINAE removes template overloads whose substitution fails, enable_if and decltype checks, void_t detection traits, and when C++20 concepts are better.
-
Moving Work to Compile Time in C++: constexpr, consteval, if constexpr and TMP
Move work into the C++ compiler with constexpr functions and classes, consteval for mandatory compile-time calls, if constexpr, and template metaprogramming.
-
C++20 consteval: Forcing Compile-Time Evaluation Where constexpr Only Allows It
C++20 consteval explained: immediate functions vs constexpr, why a constexpr wrapper cannot pass its parameter, if consteval, C++23 propagation, and real diagnostics.