TRLC Platform Library
1.0.0
Header-only C++ library for compile-time platform detection and abstraction
|
Advanced template specializations and metaprogramming utilities. More...
Go to the source code of this file.
Classes | |
struct | trlc::platform::traits::FeatureAvailable< TFeature > |
Type trait to check if a language feature is available. More... | |
struct | trlc::platform::traits::AllFeaturesAvailable< Features > |
Type trait to check if ALL features are available. More... | |
struct | trlc::platform::traits::AnyFeatureAvailable< Features > |
Type trait to check if ANY feature is available. More... | |
struct | trlc::platform::traits::RuntimeFeatureAvailable< TFeature > |
Type trait for runtime feature availability (non-constexpr) More... | |
Namespaces | |
trlc | |
trlc::platform | |
trlc::platform::traits | |
Macros | |
#define | TRLC_HAS_LANGUAGE_FEATURE(feature) (trlc::platform::hasFeature<trlc::platform::LanguageFeature::feature>()) |
Macro for testing specific language feature availability. More... | |
#define | TRLC_HAS_RUNTIME_FEATURE(feature) (trlc::platform::hasRuntimeFeature<trlc::platform::RuntimeFeature::feature>()) |
Macro for testing specific runtime feature availability. More... | |
#define | TRLC_IF_LANGUAGE_FEATURE(feature) if constexpr (trlc::platform::hasFeature<trlc::platform::LanguageFeature::feature>()) |
Macro for conditional compilation based on language feature. More... | |
#define | TRLC_IF_NO_LANGUAGE_FEATURE(feature) if constexpr (!trlc::platform::hasFeature<trlc::platform::LanguageFeature::feature>()) |
Macro for conditional compilation when language feature is NOT available. More... | |
#define | TRLC_REQUIRE_FEATURE(feature) |
Macro for template specialization based on feature availability. More... | |
#define | TRLC_REQUIRE_NO_FEATURE(feature) |
Macro for template specialization when feature is NOT available. More... | |
#define | TRLC_HAS_ALL_FEATURES(...) (trlc::platform::traits::hasAllFeatures<__VA_ARGS__>()) |
Macro for testing multiple feature requirements. More... | |
#define | TRLC_HAS_ANY_FEATURES(...) (trlc::platform::traits::hasAnyFeature<__VA_ARGS__>()) |
Macro for testing if any feature is available. More... | |
Typedefs | |
template<bool B, class T = void> | |
using | trlc::platform::traits::enable_if_t = typename std::enable_if< B, T >::type |
template<bool B> | |
using | trlc::platform::traits::bool_constant = std::integral_constant< bool, B > |
template<LanguageFeature TFeature> | |
using | trlc::platform::traits::enable_if_feature_t = enable_if_t< hasFeature< TFeature >()> |
SFINAE helper to enable template only if feature is available. More... | |
template<LanguageFeature TFeature> | |
using | trlc::platform::traits::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 | trlc::platform::traits::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 | trlc::platform::traits::enable_if_any_feature_t = enable_if_t<(hasFeature< Features >()||...)> |
SFINAE helper to enable template only if ANY feature is available. More... | |
Functions | |
template<> | |
static bool | trlc::platform::hasFeature< LanguageFeature::exceptions > () |
Template specializations for specific language features Provides optimized compile-time constants for individual features. More... | |
template<> | |
static bool | trlc::platform::hasFeature< LanguageFeature::rtti > () |
Specialization for RTTI - Direct function call for better optimization. More... | |
template<> | |
static bool | trlc::platform::hasFeature< LanguageFeature::threads > () |
Specialization for threads - Direct function call for better optimization. More... | |
template<> | |
static bool | trlc::platform::hasFeature< LanguageFeature::atomic_operations > () |
Specialization for atomic operations - Direct function call for better optimization. More... | |
template<> | |
static bool | trlc::platform::hasFeature< LanguageFeature::inline_assembly > () |
Specialization for inline assembly - Direct function call for better optimization. More... | |
template<> | |
static bool | trlc::platform::hasFeature< LanguageFeature::vector_intrinsics > () |
Specialization for vector intrinsics - Direct function call for better optimization. More... | |
template<> | |
static bool | trlc::platform::hasFeature< LanguageFeature::stack_protection > () |
Specialization for stack protection - Direct function call for better optimization. More... | |
template<> | |
static bool | trlc::platform::hasFeature< LanguageFeature::address_sanitizer > () |
Specialization for AddressSanitizer - Direct function call for better optimization. More... | |
template<> | |
static bool | trlc::platform::hasFeature< LanguageFeature::thread_sanitizer > () |
Specialization for ThreadSanitizer - Direct function call for better optimization. More... | |
template<> | |
static bool | trlc::platform::hasFeature< LanguageFeature::memory_sanitizer > () |
Specialization for MemorySanitizer - Direct function call for better optimization. More... | |
template<RuntimeFeature TFeature> | |
bool | trlc::platform::hasRuntimeFeature () |
Template function for runtime feature testing. More... | |
template<> | |
bool | trlc::platform::hasRuntimeFeature< RuntimeFeature::sse > () |
template<> | |
bool | trlc::platform::hasRuntimeFeature< RuntimeFeature::sse2 > () |
template<> | |
bool | trlc::platform::hasRuntimeFeature< RuntimeFeature::sse3 > () |
template<> | |
bool | trlc::platform::hasRuntimeFeature< RuntimeFeature::sse4_1 > () |
template<> | |
bool | trlc::platform::hasRuntimeFeature< RuntimeFeature::sse4_2 > () |
template<> | |
bool | trlc::platform::hasRuntimeFeature< RuntimeFeature::avx > () |
template<> | |
bool | trlc::platform::hasRuntimeFeature< RuntimeFeature::avx2 > () |
template<> | |
bool | trlc::platform::hasRuntimeFeature< RuntimeFeature::avx512f > () |
template<> | |
bool | trlc::platform::hasRuntimeFeature< RuntimeFeature::neon > () |
template<LanguageFeature... Features> | |
static bool | trlc::platform::traits::hasAllFeatures () |
Check if ALL specified features are available. More... | |
template<LanguageFeature... Features> | |
static bool | trlc::platform::traits::hasAnyFeature () |
Check if ANY of the specified features are available. More... | |
template<LanguageFeature... Features> | |
static std::size_t | trlc::platform::traits::countAvailableFeatures () |
Count how many of the specified features are available. More... | |
template<LanguageFeature TFeature> | |
static bool | trlc::platform::traits::getFeatureConstant () |
Get compile-time constant for a language feature. More... | |
Variables | |
template<LanguageFeature TFeature> | |
static bool | trlc::platform::traits::feature_available_v = FeatureAvailable<TFeature>::value |
Variable template for FeatureAvailable (C++14+) More... | |
template<LanguageFeature... Features> | |
static bool | trlc::platform::traits::all_features_available_v = AllFeaturesAvailable<Features...>::value |
Variable template for AllFeaturesAvailable. More... | |
template<LanguageFeature... Features> | |
static bool | trlc::platform::traits::any_feature_available_v = AnyFeatureAvailable<Features...>::value |
Variable template for AnyFeatureAvailable. More... | |
template<LanguageFeature TFeature> | |
static bool | trlc::platform::traits::feature_constant_v = getFeatureConstant<TFeature>() |
Template variable for feature constants (C++14+) More... | |
Advanced template specializations and metaprogramming utilities.
This header provides template specializations and advanced metaprogramming utilities for feature detection, extending the basic feature detection capabilities with type-safe compile-time and platform-specific features.
Definition in file traits.hpp.
#define TRLC_HAS_ALL_FEATURES | ( | ... | ) | (trlc::platform::traits::hasAllFeatures<__VA_ARGS__>()) |
Macro for testing multiple feature requirements.
... | Variadic list of LanguageFeature enum values (without namespace) |
Definition at line 377 of file traits.hpp.
#define TRLC_HAS_ANY_FEATURES | ( | ... | ) | (trlc::platform::traits::hasAnyFeature<__VA_ARGS__>()) |
Macro for testing if any feature is available.
... | Variadic list of LanguageFeature enum values (without namespace) |
Definition at line 383 of file traits.hpp.
#define TRLC_HAS_LANGUAGE_FEATURE | ( | feature | ) | (trlc::platform::hasFeature<trlc::platform::LanguageFeature::feature>()) |
Macro for testing specific language feature availability.
feature | LanguageFeature enum value (without namespace) |
Definition at line 333 of file traits.hpp.
#define TRLC_HAS_RUNTIME_FEATURE | ( | feature | ) | (trlc::platform::hasRuntimeFeature<trlc::platform::RuntimeFeature::feature>()) |
Macro for testing specific runtime feature availability.
feature | RuntimeFeature enum value (without namespace) |
Definition at line 340 of file traits.hpp.
#define TRLC_IF_LANGUAGE_FEATURE | ( | feature | ) | if constexpr (trlc::platform::hasFeature<trlc::platform::LanguageFeature::feature>()) |
Macro for conditional compilation based on language feature.
feature | LanguageFeature enum value (without namespace) |
Definition at line 347 of file traits.hpp.
#define TRLC_IF_NO_LANGUAGE_FEATURE | ( | feature | ) | if constexpr (!trlc::platform::hasFeature<trlc::platform::LanguageFeature::feature>()) |
Macro for conditional compilation when language feature is NOT available.
feature | LanguageFeature enum value (without namespace) |
Definition at line 354 of file traits.hpp.
#define TRLC_REQUIRE_FEATURE | ( | feature | ) |
Macro for template specialization based on feature availability.
feature | LanguageFeature enum value (without namespace) |
Definition at line 361 of file traits.hpp.
#define TRLC_REQUIRE_NO_FEATURE | ( | feature | ) |
Macro for template specialization when feature is NOT available.
feature | LanguageFeature enum value (without namespace) |
Definition at line 369 of file traits.hpp.