Commit 6c392fd1 authored by Max Lyon's avatar Max Lyon Committed by Patrick Schmidt

add count_if to smart ranges

parent c23d410c
......@@ -353,7 +353,16 @@ struct SmartRangeT
}
template <typename Functor>
auto count_if(Functor&& f) -> int
{
int count = 0;
auto range = static_cast<const RangeT*>(this);
for (const auto& e : *range)
if (f(e))
++count;
return count;
}
};
......
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