Utopia  2
Framework for studying models of complex & adaptive systems.
Metaprogramming and type restrictions

Metafunctions to classify types, in order to be able to restrict template parameters, and some other helpers for type computation.

Collaboration diagram for Metaprogramming and type restrictions:

Metafunctions to classify types, in order to be able to restrict template parameters, and some other helpers for type computation.

These functions are executed by the compiler, not at runtime, and can be used to restrict the typse that can be passed to template functions or discriminate between them during execution via if constexpr. The functions introduced here can later be employed to implement c++20 concepts that serve the same purpose, but with less syntactic overhead and cleaner error messages. Note that we call metafunctions implemented here concepts for bervity as well, despite the ambiguity with the C++20 concepts feature. Note also that while some of them are named like C++ NamedRequirements (e.g. is_container), they do not check if a type actually fullfills the respective NamedRequirement. The metafunctions in type_traits.hh implement a type hierarchy:

Aside from these type-restriction metafunctions, many more metafunctions are implemented therein that help modify types in a useful way, like recursively removing type extensions (const volative T****& --> T) or similar, or for checking if a type is callable or not.