util::index_of_extracted_type< Extractor, Target, Tuple > Struct Template Reference

Returns the index of the element in Tuple with the specified type. More...

#include <TupleLookupByTag.h>

Inheritance diagram for util::index_of_extracted_type< Extractor, Target, Tuple >:

Detailed Description

template<template< typename T, typename... > class Extractor, typename Target, typename Tuple>
struct util::index_of_extracted_type< Extractor, Target, Tuple >

Returns the index of the element in Tuple with the specified type.

Template Parameters
Extractorextract the candidate type from a Tuple element
Targetthe type being sought
Tupletuple-like data structure containing types.
See also
index_of_extracted_type_v, has_extracted_type, count_extracted_types, has_type,

Given a tuple-like type Tuple, this traits returns the index of the one element type which "contains" the target type Target. For example:

template <typename T>
struct ExtractValueType { using type = typename T::value_type; };
using tuple_t = std::tuple<std::vector<std::string>, std::vector<int>>;
constexpr std::size_t IntegersIndex

IntegersIndex will hold value 1, pointing to the container in tuple_t with int as value_type.

If the target type is not present, or if it is present more than once, a compilation error will ensue.

Note
Currently there is no equivalent trait to ask for the index of the second or following type; this can be implemented on request.

Definition at line 255 of file TupleLookupByTag.h.


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