Skip to content

Introduce static indices _0, _1, _2 as shortcuts for std::integral_constant<std::size_t,0> etc.

Oliver Sander requested to merge feature/introduce-static-indices into master

These indices have existed in dune-typetree for a while. They are already used extensively in dune-typetree and dune-functions, and they also make working with MultiTypeBlockVector/Matrix from dune-istl much nicer. They work very much like std::placeholders:_1, std::placeholders::_2, etc. We would have like to use that, but there is no std::placeholders_0.

This patch also introduces

template<std::size_t i>
using index_constant = std::integral_constant<std::size_t, i>;

which helps decrease code verbosity a little bit.

Merge request reports

Loading