Simulation Modeling Tool Kit
Public Types | List of all members
smtk::tuple_reduce< Reducer, Tuple, Start > Struct Template Reference

A reduce operation for tuples of typenames. More...

#include <TupleTraits.h>

Public Types

using type = typename std::conditional< std::tuple_size< Tuple >::value==0, Start, typename detail::tuple_reduce_ii< std::tuple_size< Tuple >::value, Start, Reducer, Tuple >::type >::type

Detailed Description

template<template< typename T, typename RI > class Reducer, typename Tuple, typename Start>
struct smtk::tuple_reduce< Reducer, Tuple, Start >

A reduce operation for tuples of typenames.

Each type in the Tuple is passed to the Reducer as its first argument. The second argument to the Reducer is initially the Start type but in subsequent calls to the Reducer, it is the type generated by the Reducer invocation from the prior Tuple entry.

For example, given

class A;
class B;
class C;
using Types = std::tuple<A, B, C>;
template<typename T, typename TI> class Reducer;
using Reduced = smtk::tuple_reduce<Reducer, Types, std::true_type>::type;

the Reduced type is the result of

Reducer<A, Reducer<B, Reducer<C, std::true_type>::type>::type>::type;

If the Tuple is empty, then Start is passed as the result.

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