Commit 23f54ad6 authored by Anton Bukov's avatar Anton Bukov

Simplifying skipWhile_i

parent 1a168d30
...@@ -190,7 +190,7 @@ namespace boolinq ...@@ -190,7 +190,7 @@ namespace boolinq
return where_i([=](T, int i){return i >= count;}); return where_i([=](T, int i){return i >= count;});
} }
LinqObj<Enumerator<T,std::pair<TE,int> > > skipWhile_i(std::function<bool(T,int)> predicate) const LinqObj<TE> skipWhile_i(std::function<bool(T,int)> predicate) const
{ {
auto enumerator = _enumerator; auto enumerator = _enumerator;
...@@ -202,12 +202,10 @@ namespace boolinq ...@@ -202,12 +202,10 @@ namespace boolinq
} }
catch(EnumeratorEndException &){} catch(EnumeratorEndException &){}
return Enumerator<T,std::pair<TE,int> >([=](std::pair<TE,int> & pair)->T{ return enumerator;
return pair.first.nextObject();
}, std::make_pair(enumerator,0));
} }
LinqObj<Enumerator<T,std::pair<TE,int> > > skipWhile(std::function<bool(T)> predicate) const LinqObj<TE> skipWhile(std::function<bool(T)> predicate) const
{ {
return skipWhile_i([=](T t, int /*i*/){ return predicate(t);}); return skipWhile_i([=](T t, int /*i*/){ return predicate(t);});
} }
......
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