Non-strict template metaprogramming primitives for C++.
See synopsis.hpp
for the API.
_m
meta expression template_c
meta value or meta value template_p
primitive (internal type alias or meta expression template or class)_t
type alias (from C++11)_v
value constexpr (from C++17)
A lax meta expression is a type that is a subtype of a single meta value and includes no other members aside from those defined by that meta value.
using a_meta_expression = add_m<auto_c<1>, auto_c<2>>;
struct also_a_meta_expression : a_meta_expression {};
Lax meta expression templates are typically curried and produce meta functions when partially applied.
A lax meta function is a meta value that has a static arity
constant and an inner type template template_m
that takes at least arity
types as arguments and whose result is a meta expression.
struct a_meta_function_c {
using eval = a_meta_function_c;
static constexpr size_t arity = N;
template <class Actual_1, ..., class Actual_N>
struct template_m : a_meta_expression {};
};
Lax higher-order meta functions take meta functions as arguments and use them
via the apply_m
meta expression template. Note
that template_m
need not support currying like
meta expression templates, because apply_m
takes
care of that.
A lax meta value is a meta expression whose inner eval
type is an alias for the meta expression itself.
struct a_meta_value_c {
using eval = a_meta_value_c;
// and additional members depending on value
};
Meta values also typically include additional static constants, types, or type templates.