ETL Traits
A set of traits that reflect the platform settings. It gives a C++ style interface to the library macros.
The traits are accessed under the etl::traits namespace.
All traits are constexpr for C++11 and above, const for C++03 and below.
____________________________________________________________________________________________________
Trait Type Defined Macro
using_stl bool ETL_USING_STL
using_stlport bool ETL_USING_STLPORT
using_cpp11 bool ETL_USING_CPP11
using_cpp14 bool ETL_USING_CPP14
using_cpp17 bool ETL_USING_CPP17
using_cpp20 bool ETL_USING_CPP20
using_cpp23 bool ETL_USING_CPP23
cplusplus long builtin __cplusplus
language_standard int ETL_LANGUAGE_STANDARD
using_exceptions bool ETL_USING_EXCEPTIONS
using_gcc_compiler bool ETL_USING_GCC_COMPILER
using_microsoft_compiler bool ETL_USING_MICROSOFT_COMPILER
using_arm5_compiler bool ETL_USING_ARM5_COMPILER
using_arm6_compiler bool ETL_USING_ARM6_COMPILER
using_arm7_compiler bool ETL_USING_ARM7_COMPILER
using_clang_compiler bool ETL_USING_CLANG_COMPILER
using_green_hills_compiler bool ETL_USING_GREEN_HILLS_COMPILER
using_iar_compiler bool ETL_USING_IAR_COMPILER
using_intel_compiler bool ETL_USING_INTEL_COMPILER
using_texas_instruments_compiler bool ETL_USING_TEXAS_INSTRUMENTS_COMPILER
using_generic_compiler bool ETL_USING_GENERIC_COMPILER
has_8bit_types bool ETL_USING_8BIT_TYPES
has_64bit_types bool ETL_USING_64BIT_TYPES
has_atomic bool ETL_HAS_ATOMIC
has_mutex bool ETL_HAS_MUTEX
has_nullptr bool ETL_HAS_NULLPTR
has_char8_t bool ETL_HAS_CHAR8_T
has_native_char8_t bool ETL_HAS_NATIVE_CHAR8_T
has_native_char16_t bool ETL_HAS_NATIVE_CHAR16_T
has_native_char32_t bool ETL_HAS_NATIVE_CHAR32_T
has_string_truncation_checks bool ETL_HAS_STRING_TRUNCATION_CHECKS
has_error_on_string_truncation bool ETL_HAS_ERROR_ON_STRING_TRUNCATION
has_string_clear_after_use bool ETL_HAS_STRING_CLEAR_AFTER_USE
has_istring_repair bool ETL_HAS_ISTRING_REPAIR
has_ivector_repair bool ETL_HAS_IVECTOR_REPAIR
has_mutable_array_view bool ETL_HAS_MUTABLE_ARRAY_VIEW
has_ideque_repair bool ETL_HAS_IDEQUE_REPAIR
has_initializer_list bool ETL_HAS_INITIALIZER_LIST
is_debug_build bool ETL_IS_DEBUG_BUILD
version long ETL_VERSION_VALUE
version_major long ETL_VERSION_MAJOR
version_minor long ETL_VERSION_MINOR
version_patch long ETL_VERSION_PATCH
version_string const char* ETL_VERSION
version_wstring const wchar_t* ETL_VERSION_W
version_u8string const char8_t* ETL_VERSION_U8 has_native_char8_t
version_u16string const char16_t* ETL_VERSION_U16 has_native_char16_t
version_u32string const char32_t* ETL_VERSION_U32 has_native_char32_t
____________________________________________________________________________________________________
Examples
if constexpr(etl::traits::is_debug_build)
{
std::cerr << etl::traits::version_string;
}
____________________________________________________________________________________________________
template <bool Has_Atomic = etl::traits::has_atomic>
class Controller;
template<>
class Controller<false>
{
etl::mutex lock;
};
template<>
class Controller<true>
{
etl::atomic_int lock;
};