A C++ template library for embedded applications
Designed and maintained by
Aster Consulting Ltd


Allows the smallest type to be determined.

smallest _type

Template to determine the smallest type
Defines type which is the type of the smallest parameter.
Defines size which is the size of the smallest parameter.

template <typename T1,         typename T2  = void, typename T3  = void, typename T4  = void,
          typename T5  = void, typename T6  = void, typename T7  = void, typename T8  = void,
          typename T9  = void, typename T10 = void, typename T11 = void, typename T12 = void,
          typename T13 = void, typename T14 = void, typename T15 = void, typename T16 = void>
struct smallest_type;


template <typename T1, typename T2, typename T3>
struct Test
  // Defines smallest_t as the smallest type of T1, T2 and T3.
  typedef typename etl::smallest_type<T1, T2, T3>::type largest_t;

    // Defines size as the size of the largest type.
    size = etl::largest_type<T1, T2, T3>::size;


Template to determine the smallest integral type that will accommodate the required number of bits.
Defines type which is the type of the smallest unsigned integer type.

template <const size_t N>
struct smallest_uint_for_bits;


template <const size_t N>
struct Test
  // Defines type_t as the type that will accommodate N bits.
  typedef typename etl::smallest_uint_for_bits<N>::type type_t;