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

#include <runtime_type.h>

Detailed Description

template<typename FEATURE_LIST, typename... TARGET_FEATURES>
struct density::has_features< FEATURE_LIST, TARGET_FEATURES >

Traits that checks whether a feature_list or a runtime_type (the first template parameter) contains all of the target features (from the second template parameter on). If this condition is satisfied, or if no target feature is provided, this type inherits from std::true_type. Otherwise it inherits from std::false_type.

The following example shows has_features used on a feature_list:

using MyFeatures = feature_list<f_size, f_alignment>;
static_assert(has_features<MyFeatures>::value, "");
static_assert(has_features<MyFeatures, f_size>::value, "");
static_assert(has_features<MyFeatures, f_alignment>::value, "");
static_assert(has_features<MyFeatures, f_size, f_alignment>::value, "");
static_assert(!has_features<MyFeatures, f_copy_construct>::value, "");
static_assert(!has_features<MyFeatures, f_size, f_copy_construct>::value, "");
static_assert(!has_features<MyFeatures, f_copy_construct, f_size>::value, "");

The following example shows has_features used on a runtime_type:

using type = runtime_type<f_size, f_alignment>;
static_assert(has_features<type>::value, "");
static_assert(has_features<type, f_size>::value, "");
static_assert(has_features<type, f_alignment>::value, "");
static_assert(has_features<type, f_size, f_alignment>::value, "");
static_assert(!has_features<type, f_copy_construct>::value, "");
static_assert(!has_features<type, f_size, f_copy_construct>::value, "");
static_assert(!has_features<type, f_copy_construct, f_size>::value, "");

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