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

largest

Allows the largest type or largest alignment to be determined.
This file is generated from largest_generator.h. See Generators

largest_type

Template to determine the largest type and size. By default, supports up to 16 types.
Defines type and size of the  largest type 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 largest_type;

Example

template <typename T1, typename T2, typename T3>
struct Test
{
  // Defines largest_t as the largest type of T1, T2 and T3.
  typedef typename etl::largest_type<T1, T2, T3>::type largest_t;

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

largest_alignment

Template to determine the largest alignment. By default, supports up to 16 types.
Defines value which is the largest alignment.

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

Example

template <typename T1, typename T2, typename T3>
struct Test
{
  // Defines ALIGNMENT with the value of the largest alignment of T1, T2 and T3.
  enum
  {
    ALIGNMENT = etl::largest_alignment<T1, T2, T3>::value
  };
};

larger_int_type

Template to determine the next larger sized signed int type. The template type maybe signed or unsigned.
If there is no larger type then the signed version of the original type is returned.

template <typename T>
struct larger_int_type;

Example

// Would normally define type_t as an int
typedef etl::larger_int_type<short>::type type_t;

// Would normally define type_t as an int
typedef etl::larger_int_type<unsigned short>::type type_t;

larger_uint_type

Template to determine the next larger sized unsigned int type. The template type maybe signed or unsigned.
If there is no larger type then the unsigned version of the original type is returned.

template <typename T>
struct larger_uint_type;

Example

// Would normally define type_t as an unsigned int
typedef etl::larger_uint_type<short>::type type_t;

// Would normally define type_t as an unsigned int
typedef etl::larger_uint_type<unsigned short>::type type_t;

larger_type

Template to determine the next larger sized int type. The template type maybe signed or unsigned.
Signed parameters define signed types, unsigned parameters define unsigned types.
If there is no larger type then the original type is returned.

template <typename T>
struct larger_type;

Example

// Would normally define type_t as an int
typedef etl::larger_type<short>::type type_t;

// Would normally define type_t as an unsigned int
typedef etl::larger_type<unsigned short>::type type_t;


largest

A handy combination of two of the previous templates.
Template to determine the largest type, size and alignment. By default, supports up to 16 types.
Defines type which is the type of the largest type parameter.
Defines size which is the size of the largest parameter.
Defines alignment which largest alignment of all the type parameters.
NOTE: This may not be the alignment of the largest type.

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

largest.h