Commit 5719ed18 authored by Philip Trettner's avatar Philip Trettner
Browse files

fixed smart range where

parent 483b50ab
......@@ -102,6 +102,12 @@ struct attribute_iterator : smart_iterator<attribute_iterator<AttributeT>>
template <class IteratorT, class PredT>
struct filtering_iterator final : smart_iterator<filtering_iterator<IteratorT, PredT>>
{
filtering_iterator(IteratorT it, PredT p) : it(std::forward<IteratorT>(it)), pred(std::forward<PredT>(p))
{
if (it.is_valid())
advance(); // skip initially false elements
}
IteratorT it;
PredT pred;
......
......@@ -185,6 +185,8 @@ struct filtered_range : smart_range<filtered_range<ElementT, RangeT, PredT>, Ele
{
using IteratorT = decltype(std::declval<RangeT>().begin());
filtered_range(IteratorT it, PredT p) : it_begin(std::forward<IteratorT>(it)), pred(std::forward<PredT>(p)) {}
filtering_iterator<IteratorT, PredT> begin() const { return {it_begin, pred}; }
end_iterator end() const { return {}; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment