Skip to content

per-framework/lax.cpp

 
 

Repository files navigation

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.

About

Non-strict template metaprogramming primitives for C++

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy