dune-typetree 3.0-dev
Dune::TypeTree::index_pack< i > Struct Template Reference

Simple holder class for a template argument pack of indices. More...

#include <dune/typetree/utility.hh>

Detailed Description

template<std::size_t... i>
struct Dune::TypeTree::index_pack< i >

Simple holder class for a template argument pack of indices.

The main use of index_pack is to unpack variadically templated data structures like this:

template<typename T, typename F, std::size_t... i>
void apply_to_tuple(const T& t, F f, index_pack<i...> indices)
{
discard((f(get<i>(t)),0)...);
}
std::tuple<int,double,...,char> t;
tuple_index_pack_builder< tuple >::type tuple_indices(const tuple &t)
Generate an index_pack for the tuple t.
Definition utility.hh:241
void apply_to_tuple(T &&t, F &&f, Policy=apply_to_tuple_policy::default_policy())
Apply a functor to each element of a std::tuple.
Definition utility.hh:309
void discard(Args &&... args)
No-op function to make calling a function on a variadic template argument pack legal C++.
Definition utility.hh:265
Simple holder class for a template argument pack of indices.
Definition utility.hh:207
See also
tuple_indices()
discard()

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