Commit d121f345 authored by Anton Bukov's avatar Anton Bukov

Merge pull request #13 from parallaxe/performanceImprovementOfTake

improving the performance of "take": it won't any longer iterate through...
parents 237edd05 19c6b200
......@@ -171,7 +171,11 @@ namespace boolinq
LinqObj<Enumerator<T,std::pair<TE,int> > > take(int count) const
{
return where_i([=](T, int i){return i < count;});
return where_i([=](T, int i){
if(i == count)
throw EnumeratorEndException();
return true;
});
}
LinqObj<Enumerator<T,std::pair<TE,int> > > takeWhile_i(std::function<bool(T,int)> predicate) const
......
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