density
C++11 library for paged memory management, function queues, heterogeneous queues and lifo memory management
feature_list< FEATURES > Struct Template Reference

#include <runtime_type.h>

Detailed Description

template<typename... FEATURES>
struct density::feature_list< FEATURES >

Type-list class template that can be used to specify which features a runtime_type captures from the target type.

Each type in the template arguments is either:

using FewFeatures = feature_list<f_size, f_alignment>;
using MoreFeatures = feature_list<FewFeatures, f_default_construct, f_copy_construct, f_move_construct, f_destroy>;
using ManyFeatures = feature_list<MoreFeatures, f_equal, f_less, f_hash>;

feature_list provides a template alias to an std::tuple. An instance of this tuple is a pseudo-vtable associated to the target type.

static_assert(std::is_same<
FewFeatures::tuple_type,
std::tuple<f_size, f_alignment>>::value, "");

For the composition of the tuple:

static_assert(std::is_same<
ManyFeatures::tuple_type, std::tuple<
f_size, f_alignment,
f_default_construct, f_copy_construct, f_move_construct, f_destroy,
f_equal, f_less, f_hash
>>::value, "");

Two feature lists are equivalent if they prduce the same feature tuple:

// Features1, Features2 and Features3 are equivalent....
using Features1 = feature_list<f_size, f_alignment, f_copy_construct>;
using Features2 = feature_list< feature_list<f_size>,
feature_list<f_alignment, f_copy_construct>>;
using Features3 = feature_list<
feature_list<f_size, f_none>, feature_list<feature_list<f_none>>,
feature_list<f_size, f_alignment, f_copy_construct, f_none, f_copy_construct, f_size>>;
// ...because they produce the same tuple
static_assert(std::is_same<Features1::tuple_type, Features2::tuple_type>::value, "");
static_assert(std::is_same<Features2::tuple_type, Features3::tuple_type>::value, "");

The documentation for this struct was generated from the following file: