Classes | Macros
Type lists

Classes

struct  blaze::TypeList< H, T >
 Implementation of a type list.The TypeList class is an implementation of a type list according to the example of Andrei Alexandrescu. The type list merely consists of the two data types Head and Tail. In order to create type lists of more data types, the TypeList class is used recursively: More...
 
class  blaze::Length< TList >
 Calculating the length of a type list.The Length class can be used to obtain the length of a type list (i.e. the number of contained types). In order to obtain the length of a type list, the Length class has to be instantiated for a particular type list. The length of the type list can be obtained using the member enumeration value. The following example gives an impression of the use of the Length class: More...
 
class  blaze::TypeAt< TList, Index >
 Indexing a type list.The TypeAt class can be used to access a type list at a specified position to query the according type. In order to index a type list, the TypeAt class has to be instantiated for a particular type list and an index value. The indexed type is available via the member type definition Result. The following example gives an impression of the use of the TypeAt class: More...
 
class  blaze::Contains< TList, Type >
 Searching a type list.The Contains class can be used to search the type list for a particular type Type. In contrast to the IndexOf class, the Contains class does not evaluate the index of the type but only checks whether or not the type is contained in the type list. Additionally, in contrast to the ContainsRelated class, the Contains class strictly searches for the given type Type and not for a related data type. In case the type is contained in the type list, the value member enumeration is set to 1, else it is set to 0. In order to check whether a type is part of a type list, the Contains class has to be instantiated for a particular type list and another type. The following example gives an impression of the use of the Contains class: More...
 
class  blaze::ContainsRelated< TList, Type >
 Searching a type list.The ContainsRelated class can be used to search the type list for a type related to Type. In contrast to the Contains class, the ContainsRelated class only searches for a type the given data type Type can be converted to. In case a related type is found in the type list, the value member enumeration is set to 1, else it is set to 0. In order to check whether a related type is contained in the type list, the ContainsRelated class has to be instantiated for a particular type list and another type. The following example gives an impression of the use of the ContainsRelated class: More...
 
class  blaze::IndexOf< TList, Type >
 Searching a type list.The IndexOf class can be used to search the type list for a particular type Type. In contrast to the Contains and the ContainsRelated classes, the IndexOf class evaluates the index of the given type in the type list. In case the type is contained in the type list, the value member represents the index of the queried type. Otherwise the value member is set to -1. In order to search for a type, the IndexOf class has to be instantiated for a particular type list and a search type. The following example gives an impression of the use of the IndexOf class: More...
 
class  blaze::Append< TList, Type >
 Appending a type to a type list.The Append class can be used to append the data type Type to a type list TList. In order to append a data type, the Append class has to be instantiated for a particular type list and another type. The following example gives an impression of the use of the Append class: More...
 
class  blaze::Erase< TList, Type >
 Erasing the first occurrence of a type from a type list.The Erase class can be used to erase the first occurrence of data type Type from a type list TList. In order to erase the first occurrence of a data type, the Erase class has to be instantiated for a particular type list and another type. The following example gives an impression of the use of the Erase class: More...
 
class  blaze::EraseAll< TList, Type >
 Erasing all occurrences of a type from a type list.The EraseAll class can be used to erase all occurrences of data type Type from a type list TList. In order to erase all occurrences of a data type, the EraseAll class has to be instantiated for a particular type list and another type. The following example gives an impression of the use of the EraseAll class: More...
 
class  blaze::Unique< TList >
 Erasing all duplicates from a type list.The Unique class can be used to erase all duplicates from a type list TList. In order to erase all duplicates, the Unique class has to be instantiated for a particular type list. The following example gives an impression of the use of the Unique class: More...
 

Macros

#define BLAZE_TYPELIST_1(T1)   TypeList< T1, NullType >
 Type list generation macro.This macro creates a type list only consisting of the type T1. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro: More...
 
#define BLAZE_TYPELIST_2(T1, T2)   TypeList< T1, BLAZE_TYPELIST_1( T2 ) >
 Type list generation macro.This macro creates a type list consisting of the two types T1 and T2. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro: More...
 
#define BLAZE_TYPELIST_3(T1, T2, T3)   TypeList< T1, BLAZE_TYPELIST_2( T2, T3 ) >
 Type list generation macro.This macro creates a type list consisting of the three types T1, T2 and T3. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro: More...
 
#define BLAZE_TYPELIST_4(T1, T2, T3, T4)   TypeList< T1, BLAZE_TYPELIST_3( T2, T3, T4 ) >
 Type list generation macro.This macro creates a type list consisting of the four types T1, T2, T3 and T4. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro: More...
 
#define BLAZE_TYPELIST_5(T1, T2, T3, T4, T5)   TypeList< T1, BLAZE_TYPELIST_4( T2, T3, T4, T5 ) >
 Type list generation macro.This macro creates a type list consisting of the five types T1, T2, T3, T4 and T5. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro: More...
 
#define BLAZE_TYPELIST_6(T1, T2, T3, T4, T5, T6)   TypeList< T1, BLAZE_TYPELIST_5( T2, T3, T4, T5, T6 ) >
 Type list generation macro.This macro creates a type list consisting of the six types T1, T2, T3, T4, T5 and T6. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro: More...
 
#define BLAZE_TYPELIST_7(T1, T2, T3, T4, T5, T6, T7)   TypeList< T1, BLAZE_TYPELIST_6( T2, T3, T4, T5, T6, T7 ) >
 Type list generation macro.This macro creates a type list consisting of the seven types T1, T2, T3, T4, T5, T6 and T7. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro: More...
 
#define BLAZE_TYPELIST_8(T1, T2, T3, T4, T5, T6, T7, T8)   TypeList< T1, BLAZE_TYPELIST_7( T2, T3, T4, T5, T6, T7, T8 ) >
 Type list generation macro.This macro creates a type list consisting of the eight types T1, T2, T3, T4, T5, T6, T7 and T8. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro: More...
 
#define BLAZE_TYPELIST_9(T1, T2, T3, T4, T5, T6, T7, T8, T9)   TypeList< T1, BLAZE_TYPELIST_8( T2, T3, T4, T5, T6, T7, T8, T9 ) >
 Type list generation macro.This macro creates a type list consisting of the nine types T1, T2, T3, T4, T5, T6, T7, T8 and T9. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro: More...
 
#define BLAZE_TYPELIST_10(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)   TypeList< T1, BLAZE_TYPELIST_9( T2, T3, T4, T5, T6, T7, T8, T9, T10 ) >
 Type list generation macro.This macro creates a type list consisting of the ten types T1, T2, T3, T4, T5, T6, T7, T8, T9 and T10. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro: More...
 

Detailed Description

Type lists provide the functionality to create lists of data types. In constrast to lists of data values (as for instance the std::list class template), type lists are created at compile time, not at run time. The type list implementation of the Blaze library closely resembles the original implementation of Andrei Alexandrescu (taken from his book Modern C++, ISBN: 0201704315). The following example demonstrates, how type lists are created and manipulated:

// Creating a type list consisting of two fundamental floating point data types
using Tmp = BLAZE_TYPELIST_2( float, double );
// Appending a type to the type list
using Floats = blaze::Append< Tmp, long double >::Result; // Type list contains all floating point data types
// Calculating the length of the type list (at compile time!)
const int length = Length< Floats >::value; // Value evaluates to 3
// Accessing a specific type of the type list via indexing
// Searching the type list for a specific type
const int index1 = blaze::Contains< Floats, double >::value; // Value evaluates to 1
const int index2 = blaze::Contains< Floats, int >::value; // Value evaluates to 0
// Estimating the index of a specific type in the type list
const int index3 = blaze::IndexOf< Floats, double >::value; // Value evaluates to 1
const int index4 = blaze::IndexOf< Floats, int >::value; // Value evaluates to -1
// Erasing the first occurrence of float from the type list
// Removing all duplicates from the type list
using NoDuplicates = blaze::Unique< Floats >::Result;

Macro Definition Documentation

◆ BLAZE_TYPELIST_1

#define BLAZE_TYPELIST_1 (   T1)    TypeList< T1, NullType >

Type list generation macro.This macro creates a type list only consisting of the type T1. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro:

// Definition of a new type list consisting of a single data type
using MyTypes = BLAZE_TYPELIST_1( int );
// Calculating the length of the type list
const int length = Length<MyTypes>::value;

◆ BLAZE_TYPELIST_10

#define BLAZE_TYPELIST_10 (   T1,
  T2,
  T3,
  T4,
  T5,
  T6,
  T7,
  T8,
  T9,
  T10 
)    TypeList< T1, BLAZE_TYPELIST_9( T2, T3, T4, T5, T6, T7, T8, T9, T10 ) >

Type list generation macro.This macro creates a type list consisting of the ten types T1, T2, T3, T4, T5, T6, T7, T8, T9 and T10. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro:

// Definition of a new type list consisting of ten data types
using MyTypes = BLAZE_TYPELIST_10( unsigned char, signed char, char, wchar_t, unsigned short,
short, unsigned int, int, unsigned long, long );
// Calculating the length of the type list
const int length = Length<MyTypes>::value;

◆ BLAZE_TYPELIST_2

#define BLAZE_TYPELIST_2 (   T1,
  T2 
)    TypeList< T1, BLAZE_TYPELIST_1( T2 ) >

Type list generation macro.This macro creates a type list consisting of the two types T1 and T2. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro:

// Definition of a new type list consisting of two data types
using MyTypes = BLAZE_TYPELIST_2( int, unsigned int );
// Calculating the length of the type list
const int length = Length<MyTypes>::value;

◆ BLAZE_TYPELIST_3

#define BLAZE_TYPELIST_3 (   T1,
  T2,
  T3 
)    TypeList< T1, BLAZE_TYPELIST_2( T2, T3 ) >

Type list generation macro.This macro creates a type list consisting of the three types T1, T2 and T3. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro:

// Definition of a new type list consisting of three data types
using MyTypes = BLAZE_TYPELIST_3( float, double, long double );
// Calculating the length of the type list
const int length = Length<MyTypes>::value;

◆ BLAZE_TYPELIST_4

#define BLAZE_TYPELIST_4 (   T1,
  T2,
  T3,
  T4 
)    TypeList< T1, BLAZE_TYPELIST_3( T2, T3, T4 ) >

Type list generation macro.This macro creates a type list consisting of the four types T1, T2, T3 and T4. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro:

// Definition of a new type list consisting of four data types
using MyTypes = BLAZE_TYPELIST_4( unsigned char, signed char, char, wchar_t );
// Calculating the length of the type list
const int length = Length<MyTypes>::value;

◆ BLAZE_TYPELIST_5

#define BLAZE_TYPELIST_5 (   T1,
  T2,
  T3,
  T4,
  T5 
)    TypeList< T1, BLAZE_TYPELIST_4( T2, T3, T4, T5 ) >

Type list generation macro.This macro creates a type list consisting of the five types T1, T2, T3, T4 and T5. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro:

// Definition of a new type list consisting of five data types
using MyTypes = BLAZE_TYPELIST_5( char, short, int, long, float );
// Calculating the length of the type list
const int length = Length<MyTypes>::value;

◆ BLAZE_TYPELIST_6

#define BLAZE_TYPELIST_6 (   T1,
  T2,
  T3,
  T4,
  T5,
  T6 
)    TypeList< T1, BLAZE_TYPELIST_5( T2, T3, T4, T5, T6 ) >

Type list generation macro.This macro creates a type list consisting of the six types T1, T2, T3, T4, T5 and T6. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro:

// Definition of a new type list consisting of six data types
using MyTypes = BLAZE_TYPELIST_6( char, short, int, long, float, double );
// Calculating the length of the type list
const int length = Length<MyTypes>::value;

◆ BLAZE_TYPELIST_7

#define BLAZE_TYPELIST_7 (   T1,
  T2,
  T3,
  T4,
  T5,
  T6,
  T7 
)    TypeList< T1, BLAZE_TYPELIST_6( T2, T3, T4, T5, T6, T7 ) >

Type list generation macro.This macro creates a type list consisting of the seven types T1, T2, T3, T4, T5, T6 and T7. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro:

// Definition of a new type list consisting of seven data types
using MyTypes = BLAZE_TYPELIST_7( char, short, int, long, float, double, long double );
// Calculating the length of the type list
const int length = Length<MyTypes>::value;

◆ BLAZE_TYPELIST_8

#define BLAZE_TYPELIST_8 (   T1,
  T2,
  T3,
  T4,
  T5,
  T6,
  T7,
  T8 
)    TypeList< T1, BLAZE_TYPELIST_7( T2, T3, T4, T5, T6, T7, T8 ) >

Type list generation macro.This macro creates a type list consisting of the eight types T1, T2, T3, T4, T5, T6, T7 and T8. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro:

// Definition of a new type list consisting of eight data types
using MyTypes = BLAZE_TYPELIST_8( char, wchar_t, short, int, long, float, double, long double );
// Calculating the length of the type list
const int length = Length<MyTypes>::value;

◆ BLAZE_TYPELIST_9

#define BLAZE_TYPELIST_9 (   T1,
  T2,
  T3,
  T4,
  T5,
  T6,
  T7,
  T8,
  T9 
)    TypeList< T1, BLAZE_TYPELIST_8( T2, T3, T4, T5, T6, T7, T8, T9 ) >

Type list generation macro.This macro creates a type list consisting of the nine types T1, T2, T3, T4, T5, T6, T7, T8 and T9. The terminating type for the type list is the NullType. The following example demonstrates the use of this macro:

// Definition of a new type list consisting of nine data types
using MyTypes = BLAZE_TYPELIST_9( char, signed char, wchar_t, short, int, long, float, double, long double );
// Calculating the length of the type list
const int length = Length<MyTypes>::value;