TRLC Platform Library  1.0.0
Header-only C++ library for compile-time platform detection and abstraction
trlc::platform::traits Namespace Reference

Classes

struct  FeatureAvailable
 Type trait to check if a language feature is available. More...
 
struct  AllFeaturesAvailable
 Type trait to check if ALL features are available. More...
 
struct  AnyFeatureAvailable
 Type trait to check if ANY feature is available. More...
 
struct  RuntimeFeatureAvailable
 Type trait for runtime feature availability (non-constexpr) More...
 

Typedefs

template<bool B, class T = void>
using enable_if_t = typename std::enable_if< B, T >::type
 
template<bool B>
using bool_constant = std::integral_constant< bool, B >
 
template<LanguageFeature TFeature>
using enable_if_feature_t = enable_if_t< hasFeature< TFeature >()>
 SFINAE helper to enable template only if feature is available. More...
 
template<LanguageFeature TFeature>
using enable_if_no_feature_t = enable_if_t<!hasFeature< TFeature >()>
 SFINAE helper to enable template only if feature is NOT available. More...
 
template<LanguageFeature... Features>
using enable_if_all_features_t = enable_if_t<(hasFeature< Features >() &&...)>
 SFINAE helper to enable template only if ALL features are available. More...
 
template<LanguageFeature... Features>
using enable_if_any_feature_t = enable_if_t<(hasFeature< Features >()||...)>
 SFINAE helper to enable template only if ANY feature is available. More...
 

Functions

template<LanguageFeature... Features>
static bool hasAllFeatures ()
 Check if ALL specified features are available. More...
 
template<LanguageFeature... Features>
static bool hasAnyFeature ()
 Check if ANY of the specified features are available. More...
 
template<LanguageFeature... Features>
static std::size_t countAvailableFeatures ()
 Count how many of the specified features are available. More...
 
template<LanguageFeature TFeature>
static bool getFeatureConstant ()
 Get compile-time constant for a language feature. More...
 

Variables

template<LanguageFeature TFeature>
static bool feature_available_v = FeatureAvailable<TFeature>::value
 Variable template for FeatureAvailable (C++14+) More...
 
template<LanguageFeature... Features>
static bool all_features_available_v = AllFeaturesAvailable<Features...>::value
 Variable template for AllFeaturesAvailable. More...
 
template<LanguageFeature... Features>
static bool any_feature_available_v = AnyFeatureAvailable<Features...>::value
 Variable template for AnyFeatureAvailable. More...
 
template<LanguageFeature TFeature>
static bool feature_constant_v = getFeatureConstant<TFeature>()
 Template variable for feature constants (C++14+) More...
 

Typedef Documentation

◆ bool_constant

template<bool B>
using trlc::platform::traits::bool_constant = typedef std::integral_constant<bool, B>

Definition at line 165 of file traits.hpp.

◆ enable_if_all_features_t

template<LanguageFeature... Features>
using trlc::platform::traits::enable_if_all_features_t = typedef enable_if_t<(hasFeature<Features>() && ...)>

SFINAE helper to enable template only if ALL features are available.

Template Parameters
FeaturesVariadic LanguageFeatures to check

Definition at line 198 of file traits.hpp.

◆ enable_if_any_feature_t

template<LanguageFeature... Features>
using trlc::platform::traits::enable_if_any_feature_t = typedef enable_if_t<(hasFeature<Features>() || ...)>

SFINAE helper to enable template only if ANY feature is available.

Template Parameters
FeaturesVariadic LanguageFeatures to check

Definition at line 205 of file traits.hpp.

◆ enable_if_feature_t

template<LanguageFeature TFeature>
using trlc::platform::traits::enable_if_feature_t = typedef enable_if_t<hasFeature<TFeature>()>

SFINAE helper to enable template only if feature is available.

Template Parameters
TFeatureLanguageFeature to check

Definition at line 184 of file traits.hpp.

◆ enable_if_no_feature_t

template<LanguageFeature TFeature>
using trlc::platform::traits::enable_if_no_feature_t = typedef enable_if_t<!hasFeature<TFeature>()>

SFINAE helper to enable template only if feature is NOT available.

Template Parameters
TFeatureLanguageFeature to check

Definition at line 191 of file traits.hpp.

◆ enable_if_t

template<bool B, class T = void>
using trlc::platform::traits::enable_if_t = typedef typename std::enable_if<B, T>::type

Definition at line 162 of file traits.hpp.

Function Documentation

◆ countAvailableFeatures()

template<LanguageFeature... Features>
static std::size_t trlc::platform::traits::countAvailableFeatures ( )
static

Count how many of the specified features are available.

Template Parameters
FeaturesVariadic list of LanguageFeatures
Returns
Number of available features

Definition at line 237 of file traits.hpp.

◆ getFeatureConstant()

template<LanguageFeature TFeature>
static bool trlc::platform::traits::getFeatureConstant ( )
static

Get compile-time constant for a language feature.

Template Parameters
TFeatureLanguageFeature to get constant for
Returns
Compile-time boolean constant

Definition at line 310 of file traits.hpp.

◆ hasAllFeatures()

template<LanguageFeature... Features>
static bool trlc::platform::traits::hasAllFeatures ( )
static

Check if ALL specified features are available.

Template Parameters
FeaturesVariadic list of LanguageFeatures
Returns
true if all features are available, false otherwise

Definition at line 217 of file traits.hpp.

◆ hasAnyFeature()

template<LanguageFeature... Features>
static bool trlc::platform::traits::hasAnyFeature ( )
static

Check if ANY of the specified features are available.

Template Parameters
FeaturesVariadic list of LanguageFeatures
Returns
true if any feature is available, false otherwise

Definition at line 227 of file traits.hpp.

Variable Documentation

◆ all_features_available_v

template<LanguageFeature... Features>
bool trlc::platform::traits::all_features_available_v = AllFeaturesAvailable<Features...>::value
static

Variable template for AllFeaturesAvailable.

Template Parameters
FeaturesVariadic LanguageFeatures to check

Definition at line 271 of file traits.hpp.

◆ any_feature_available_v

template<LanguageFeature... Features>
bool trlc::platform::traits::any_feature_available_v = AnyFeatureAvailable<Features...>::value
static

Variable template for AnyFeatureAvailable.

Template Parameters
FeaturesVariadic LanguageFeatures to check

Definition at line 285 of file traits.hpp.

◆ feature_available_v

template<LanguageFeature TFeature>
bool trlc::platform::traits::feature_available_v = FeatureAvailable<TFeature>::value
static

Variable template for FeatureAvailable (C++14+)

Template Parameters
TFeatureLanguageFeature to check

Definition at line 257 of file traits.hpp.

◆ feature_constant_v

template<LanguageFeature TFeature>
bool trlc::platform::traits::feature_constant_v = getFeatureConstant<TFeature>()
static

Template variable for feature constants (C++14+)

Template Parameters
TFeatureLanguageFeature to check

Definition at line 319 of file traits.hpp.