Skip to content
Snippets Groups Projects
Commit 7eefb642 authored by Max Kahnt's avatar Max Kahnt
Browse files

Add sparseRangeFirst hybrid applicator.

parent cc37808b
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,17 @@ void sparseRangeFor(Range&& range, F&& f) ...@@ -36,7 +36,17 @@ void sparseRangeFor(Range&& range, F&& f)
f(*it, it.index()); f(*it, it.index());
} }
//! \brief Hybrid access to first sparse range element (static/tuple-like candiate)
template <class Range, class F, std::enable_if_t<isTupleOrDerived<Range>(), int> = 0>
void sparseRangeFirst(Range&& range, F&& f) {
f(range[Indices::_0]);
}
//! \brief Hybrid access to first sparse range element (dynamic/sparse candiate)
template<class Range, class F, std::enable_if_t<not isTupleOrDerived<Range>(), int> = 0>
void sparseRangeFirst(Range&& range, F&& f)
{
f(*range.begin());
}
} // namespace MatrixVector } // namespace MatrixVector
} // namespace Dune } // namespace Dune
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment