|
3 | 3 | Non-strict template metaprogramming primitives for C++.
|
4 | 4 |
|
5 | 5 | See [`synopsis.hpp`](provides/include/lax_v1/synopsis.hpp) for the API.
|
| 6 | + |
| 7 | +## <a id="contents"></a> [≡](#contents) [Contents](#contents) |
| 8 | + |
| 9 | +- [Legend](#legend) |
| 10 | +- [Glossary](#glossary) |
| 11 | + - [Currying](#currying) |
| 12 | + - [Meta expression](#meta-expression) |
| 13 | + - [Meta function](#meta-function) |
| 14 | + - [Meta value](#meta-value) |
| 15 | + - [Non-strict evaluation](#non-strict-evaluation) |
| 16 | +- [Motivation](#motivation) |
| 17 | +- [References](#references) |
| 18 | + |
| 19 | +## <a id="legend"></a> [≡](#contents) [Legend](#legend) |
| 20 | + |
| 21 | +- `_m` [meta expression](#meta-expression) template |
| 22 | +- `_c` [meta value](#meta-value) or meta value template |
| 23 | +- `_p` primitive (internal type alias or meta expression template or class) |
| 24 | +- `_t` type alias (from C++11) |
| 25 | +- `_v` value constexpr (from C++17) |
| 26 | + |
| 27 | +## <a id="glossary"></a> [≡](#contents) [Glossary](#glossary) |
| 28 | + |
| 29 | +### <a id="currying"></a> [≡](#contents) [Currying](#currying) |
| 30 | + |
| 31 | +### <a id="meta-expression"></a> [≡](#contents) [Meta expression](#meta-expression) |
| 32 | + |
| 33 | +A lax meta expression is a type that is a subtype of a single |
| 34 | +[meta value](#meta-value) and includes no other members aside from those defined |
| 35 | +by that meta value. |
| 36 | + |
| 37 | +```c++ |
| 38 | +using a_meta_expression = add_m<auto_c<1>, auto_c<2>>; |
| 39 | +struct also_a_meta_expression : a_meta_expression {}; |
| 40 | +``` |
| 41 | +
|
| 42 | +Lax meta expression templates are typically [curried](#curried) and produce |
| 43 | +[meta functions](#meta-function) when partially applied. |
| 44 | +
|
| 45 | +### <a id="meta-function"></a> [≡](#contents) [Meta function](#meta-function) |
| 46 | +
|
| 47 | +A lax meta function is a [meta value](#meta-value) that has a static `arity` |
| 48 | +constant and an inner type template `template_m` that takes at least `arity` |
| 49 | +types as arguments and whose result is a [meta expression](#meta-expression). |
| 50 | +
|
| 51 | +```c++ |
| 52 | +struct a_meta_function_c { |
| 53 | + using eval = a_meta_function_c; |
| 54 | + static constexpr size_t arity = N; |
| 55 | + template <class Actual_1, ..., class Actual_N> |
| 56 | + struct template_m : a_meta_expression {}; |
| 57 | +}; |
| 58 | +``` |
| 59 | + |
| 60 | +Lax higher-order meta functions take meta functions as arguments and use them |
| 61 | +via the `apply_m` [meta expression template](#meta-expression-template). Note |
| 62 | +that `template_m` need not support [currying](#currying) like |
| 63 | +[meta expression templates](#meta-expression-template), because `apply_m` takes |
| 64 | +care of that. |
| 65 | + |
| 66 | +### <a id="meta-value"></a> [≡](#contents) [Meta value](#meta-value) |
| 67 | + |
| 68 | +A lax meta value is a [meta expression](#meta-expression) whose inner `eval` |
| 69 | +type is an alias for the meta expression itself. |
| 70 | + |
| 71 | +```c++ |
| 72 | +struct a_meta_value_c { |
| 73 | + using eval = a_meta_value_c; |
| 74 | + // and additional members depending on value |
| 75 | +}; |
| 76 | +``` |
| 77 | +
|
| 78 | +Meta values also typically include additional static constants, types, or type |
| 79 | +templates. |
| 80 | +
|
| 81 | +### <a id="non-strict-evaluation"></a> [≡](#contents) [Non-strict evaluation](#non-strict-evaluation) |
| 82 | +
|
| 83 | +## <a id="motivation"></a> [≡](#contents) [Motivation](#motivation) |
| 84 | +
|
| 85 | +## <a id="references"></a> [≡](#contents) [References](#references) |
0 commit comments