Skip to content

ETL Traits

Header: various
Since: TBC

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.

Traits

TraitTypeDefined byMacro
using_stlboolplatform.hETL_USING_STL
using_stlportboolplatform.hETL_USING_STLPORT
using_cpp11boolplatform.hETL_USING_CPP11
using_cpp14boolplatform.hETL_USING_CPP14
using_cpp17boolplatform.hETL_USING_CPP17
using_cpp20boolplatform.hETL_USING_CPP20
using_cpp23boolplatform.hETL_USING_CPP23
cpluspluslongbuiltin__cplusplus
language_standardintplatform.hETL_LANGUAGE_STANDARD
using_exceptionsboolplatform.hETL_USING_EXCEPTIONS
using_gcc_compilerboolplatform.hETL_USING_GCC_COMPILER
using_microsoft_compilerboolplatform.hETL_USING_MICROSOFT_COMPILER
using_arm5_compilerboolplatform.hETL_USING_ARM5_COMPILER
using_arm6_compilerboolplatform.hETL_USING_ARM6_COMPILER
using_arm7_compilerboolplatform.hETL_USING_ARM7_COMPILER
using_clang_compilerboolplatform.hETL_USING_CLANG_COMPILER
using_green_hills_compilerboolplatform.hETL_USING_GREEN_HILLS_COMPILER
using_iar_compilerboolplatform.hETL_USING_IAR_COMPILER
using_intel_compilerboolplatform.hETL_USING_INTEL_COMPILER
using_texas_instruments_compilerboolplatform.hETL_USING_TEXAS_INSTRUMENTS_COMPILER
using_builtin_is_assignableboolplatform.hETL_USING_BUILTIN_IS_ASSIGNABLE
using_builtin_is_constructibleboolplatform.hETL_USING_BUILTIN_IS_CONSTRUCTIBLE
using_builtin_is_trivially_constructibleboolplatform.hETL_USING_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE
using_builtin_is_trivially_destructibleboolplatform.hETL_USING_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE
using_builtin_is_trivially_copyableboolplatform.hETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE
using_builtin_underlying_typeboolplatform.hETL_USING_BUILTIN_UNDERLYING_TYPE
using_builtin_memcpyboolplatform.hETL_USING_BUILTIN_MEMCPY
using_builtin_memmoveboolplatform.hETL_USING_BUILTIN_MEMMOVE
using_builtin_memsetboolplatform.hETL_USING_BUILTIN_MEMSET
using_builtin_memcmpboolplatform.hETL_USING_BUILTIN_MEMCMP
using_builtin_memchrboolplatform.hETL_USING_BUILTIN_MEMCHR
using_generic_compilerboolplatform.hETL_USING_GENERIC_COMPILER
has_8bit_typesboolplatform.hETL_USING_8BIT_TYPES
has_64bit_typesboolplatform.hETL_USING_64BIT_TYPES
has_atomicboolplatform.hETL_HAS_ATOMIC
has_mutexboolmutex.hETL_HAS_MUTEX
has_nullptrboolplatform.hETL_HAS_NULLPTR
has_char8_tboolplatform.hETL_HAS_CHAR8_T
has_native_char8_tboolplatform.hETL_HAS_NATIVE_CHAR8_T
has_native_char16_tboolplatform.hETL_HAS_NATIVE_CHAR16_T
has_native_char32_tboolplatform.hETL_HAS_NATIVE_CHAR32_T
has_string_truncation_checksboolplatform.hETL_HAS_STRING_TRUNCATION_CHECKS
has_error_on_string_truncationboolplatform.hETL_HAS_ERROR_ON_STRING_TRUNCATION
has_string_clear_after_useboolplatform.hETL_HAS_STRING_CLEAR_AFTER_USE
has_istring_repairboolplatform.hETL_HAS_ISTRING_REPAIR
has_ivector_repairboolplatform.hETL_HAS_IVECTOR_REPAIR
has_mutable_array_viewboolplatform.hETL_HAS_MUTABLE_ARRAY_VIEW
has_ideque_repairboolplatform.hETL_HAS_IDEQUE_REPAIR
has_initializer_listboolplatform.hETL_HAS_INITIALIZER_LIST
is_debug_buildboolplatform.hETL_IS_DEBUG_BUILD
versionlongversion.hETL_VERSION_VALUE
version_majorlongversion.hETL_VERSION_MAJOR
version_minorlongversion.hETL_VERSION_MINOR
version_patchlongversion.hETL_VERSION_PATCH
version_stringconst char*version.hETL_VERSION
version_wstringconst wchar_t *version.hETL_VERSION_W
version_u8stringconst char8_t*version.hETL_VERSION_U8 if has_native_char8_t
version_u16stringconst char16_t*version.hETL_VERSION_U16
version_u32stringconst char32_t*version.hETL_VERSION_U32

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;
};