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

[doc] Add more docs and unify indentation

parent dc826c70
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -178,9 +178,7 @@ public: ...@@ -178,9 +178,7 @@ public:
} }
constexpr T operator[](const T&i) const constexpr T operator[](const T&i) const
{ { return begin()+i; }
return begin()+i;
}
private: private:
T begin_; T begin_;
...@@ -268,6 +266,7 @@ constexpr void forEach(Range&& range, F&& f, PriorityTag<0>) ...@@ -268,6 +266,7 @@ constexpr void forEach(Range&& range, F&& f, PriorityTag<0>)
{ {
for(std::size_t i=0; i<range.size(); ++i) for(std::size_t i=0; i<range.size(); ++i)
f(range[i]); f(range[i]);
// \ToDo Why does the following not compile?
// for(auto e : range) // for(auto e : range)
// f(e); // f(e);
} }
...@@ -276,12 +275,30 @@ constexpr void forEach(Range&& range, F&& f, PriorityTag<0>) ...@@ -276,12 +275,30 @@ constexpr void forEach(Range&& range, F&& f, PriorityTag<0>)
/**
* \brief Range based for loop
*
* \tparam Range Type of given range
* \tparam F Type of given predicate
*
* \param range The range to loop over
* \param f A predicate that will be called with each entry of the range
*
* This supports looping over the following ranges
* * ranges obtained from integralRange()
* * all ranges that provide HybridAlgorithm::size() and HybridAlgorithm::elementAt()
*
* This especially included instances of std::integer_sequence,
* std::tuple, Dune::TupleVector, and Dune::MultiTypeBlockVector.
*/
template<class Range, class F> template<class Range, class F>
constexpr void forEach(Range&& range, F&& f) constexpr void forEach(Range&& range, F&& f)
{ {
HybridAlgorithm::Imp::forEach(std::forward<Range>(range), std::forward<F>(f), PriorityTag<42>()); HybridAlgorithm::Imp::forEach(std::forward<Range>(range), std::forward<F>(f), PriorityTag<42>());
} }
} // namespace HybridAlgorithm } // namespace HybridAlgorithm
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment