Blaze  3.6
blaze::ContainsRelated< TL, T > Struct Template Reference

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 true, else it is set to false. 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...

#include <ContainsRelated.h>

Detailed Description

template<typename TL, typename T>
struct blaze::ContainsRelated< TL, T >

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 true, else it is set to false. 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:

class A {};
class B : public A {};
class C {};
class D {};
// Defining a new type list
// Searching for the type A in the type list
constexpr bool a = blaze::ContainsRelated< Types, A >::value; // Evaluates to 1, type A is found
// Searching for the derived type B in the type list
constexpr bool b = blaze::ContainsRelated< Types, B >::value; // Evaluates to 1, base type A is found
// Searching for the type C in the type list
constexpr bool c = blaze::ContainsRelated< Types, D >::value; // Evaluates to 0, no related type found

The documentation for this struct was generated from the following file: