density
C++11 library for paged memory management, function queues, heterogeneous queues and lifo memory management
TypeFeature (named requirement)

Requirements

A type F is a TypeFeature if:

Notes

A type feature is a class that captures and exposes a specific property or action of a target type, without depending from it at compile time. Most times features store a pointer to a function (that is like an entry in a vtable), but they may hold just data (like f_size and f_alignment do).

Usually a TypeFeature has this form:

struct f_feature
{
// returns an instance of this feature bound to a specific target type
template <typename TARGET_TYPE>
constexpr static type make() noexcept;
// invokes the feature. The return type and the parameters depends on the specific feature
... operator()(...) const;
};

The static function template make creates an instance of the feature bound to a type. The function call operator invokes the feature.

The following snippet shows the synopsis of f_size, f_default_construct and f_equal.

struct f_size
{
template <typename TARGET_TYPE>
constexpr static f_size make() noexcept;
constexpr size_t operator()() const noexcept;
};
struct f_default_construct
{
template <typename TARGET_TYPE>
constexpr static f_default_construct make() noexcept;
void operator()(void * i_dest) const;
};
struct f_equal
{
template <typename TARGET_TYPE>
constexpr static f_equal make() noexcept;
bool operator()(void const * i_first, void const * i_second) const;
};