Skip to content
Snippets Groups Projects
Commit 708acf85 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Merge branch 'feature/unpack-integer-sequence' into 'master'

Add helper function unpackIntegerSequence

See merge request !495
parents cb9f8a59 4ec65731
Branches
Tags
1 merge request!495Add helper function unpackIntegerSequence
Pipeline #
......@@ -108,6 +108,22 @@ namespace Dune
} // namespace Indices
/**
* \brief Unpack an std::integer_sequence<I,i...> to std::integral_constant<I,i>...
*
* This forward all entries of the given std::integer_sequence
* as individual std::integral_constant arguments to the given callback.
*
* \param f Callback which has to accept unpacked values
* \param sequence Packed std::integer_sequence of values
* \returns Result of calling f with unpacked integers.
*/
template<class F, class I, I... i>
decltype(auto) unpackIntegerSequence(F&& f, std::integer_sequence<I, i...> sequence)
{
return f(std::integral_constant<I, i>()...);
}
} //namespace Dune
#endif // DUNE_COMMON_INDICES_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment