A C++ template library for embedded applications
Designed and maintained by
Aster Consulting Ltd
MIT licensed
Join the ETL community

type_traits

Reverse engineered types traits classes from C++ 11 plus several ETL extensions.
This file is generated from type_traits_generator.h. See Generators
Not all traits have been defined as some rely on compiler intrinsics that are not available on all compiler platforms.
See type_traits for more information

integral_constant
remove_reference
add_reference
remove_pointer
add_pointer
is_const
remove_const
add_const
is_volatile
remove_volatile
add_volatile
remove_cv
add_cv
add_volatile
is_integral
is_signed
is_unsigned
is_floating_point
is_same
is_void
is_arithmetic
is_fundamental
is_compound
is_array
is_pointer
is_reference
is_base_of
make_signed
make_unsigned
enable_if
conditional
extent
remove_extent
remove_all_extents
rank
decay
alignment_of

The following will use the C++11 definitions if platform.h detects that they are available with the current compiler.
is_pod
is_trivially_constructible
is_trivially_copy_constructible
is_trivially_destructible
is_trivially_copy_assignable


____________________________________________________________________________________________________

ETL extensions


____________________________________________________________________________________________________

is_one_of


value
Set to true if the first template type is one of the subsequent types, otherwise false.

Example

bool isOK;

isOK = etl::is_one_of<int, char, short, int, long>::value;    // Sets 'isOK' to true.
isOK = etl::is_one_of<double, char, short, int, long>::value; // Sets 'isOK' to false.

____________________________________________________________________________________________________

conditional_integral_constant

value
Set to the constant determined by the condition.

Example

int value;

value = etl::conditional_integral_constant<true,  1, 2>::value; // Sets value to 1

value = etl::conditional_integral_constant<false, 1, 2>::value; // Sets value to 2



____________________________________________________________________________________________________

types

Extracts the basic types from a template type.

type
The underlying type.

reference
A reference to the underlying type.

const_reference
A const reference to the underlying type.

pointer
A pointer to the underlying type.

const_pointer
A const pointer to the underlying type.

Example

typedef const int* const MyType;

etl::types<MyType>::type                int
etl::types<MyType>::reference           int&
etl::types<MyType>::const_reference     const int&
etl::types<MyType>::pointer             int*
etl::types<MyType>::const_pointer       const int*
etl::types<MyType>::const_pointer_const const int* const

____________________________________________________________________________________________________

size_of


By default, defines a size value identical to sizeof.

Specialisation for void which define the size as 1.
This is normally an undefined value, but when using template metaprogramming, sizeof(void) may occur.

The user may define specialisations of their own if required, even for fundamental types.

Example

struct S
{
};

namespace etl
{
  template <>
  constexpr size_t size_of<S>()
  {
    return 20;
  };
}

size_t s;
s = etl::size_of<char>(); // 1
s = etl::size_of<S>();    // 20
type_traits.h