FindUniqueTupleIndex< SEARCHTYPE, TUPLETYPE > Struct Template Reference

#include <tuple.h>

Detailed Description

template<typename SEARCHTYPE, typename TUPLETYPE>
struct maxon::FindUniqueTupleIndex< SEARCHTYPE, TUPLETYPE >

A class that can be used to find the index of a unique element type in a tuple. If no match was found or the type was not unique, a negative value is used. Unique means there is exactly one element with the given type. Works at compile time.

Example:

static const Int index = FindTupleIndex<String, Tuple<Int, String, String>>::value;
// index is negative, because String occurs twice
static_assert(index < 0, "type not found");

::value contains the index of the type if it was found exactly once, or a negative value otherwise.

Template Parameters
SEARCHTYPEType to search for.
TUPLETYPEType of the tuple that is searched in.
Int
maxon::Int Int
Definition: ge_sys_math.h:64
static_assert
#define static_assert(cond, str)
Definition: compilerdetection.h:378