Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
boolinq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
boolinq
Commits
16444e74
Commit
16444e74
authored
Jun 30, 2013
by
Jakub Pawlik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skipWhile_i improvements
a "lazy" version of the skipWhile_i function
parent
49f2b8cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
13 deletions
+10
-13
SkipWhileRangeTest.cpp
boolinq/SkipWhileRangeTest.cpp
+0
-2
boolinq.h
boolinq/boolinq.h
+10
-11
No files found.
boolinq/SkipWhileRangeTest.cpp
View file @
16444e74
...
...
@@ -19,8 +19,6 @@ TEST(SkipWhileRange, ManyToMore)
auto
rng
=
from
(
src
);
auto
dst
=
rng
.
skipWhile
([](
int
it
){
return
it
<
0
||
it
>
10
;});
auto
vec
=
dst
.
toVector
();
CheckRangeEqArray
(
dst
,
ans
);
}
...
...
boolinq/boolinq.h
View file @
16444e74
...
...
@@ -192,19 +192,18 @@ namespace boolinq
LinqObj
<
Enumerator
<
T
,
std
::
pair
<
TE
,
int
>
>
>
skipWhile_i
(
std
::
function
<
bool
(
T
,
int
)
>
predicate
)
const
{
auto
enumerator
=
_enumerator
;
try
{
int
i
=
0
;
while
(
predicate
(
TE
(
enumerator
).
nextObject
(),
i
++
))
enumerator
.
nextObject
();
}
catch
(
EnumeratorEndException
&
){}
return
Enumerator
<
T
,
std
::
pair
<
TE
,
int
>
>
([
=
](
std
::
pair
<
TE
,
int
>
&
pair
)
->
T
{
if
(
0
==
pair
.
second
)
{
T
t
;
do
t
=
pair
.
first
.
nextObject
();
while
(
predicate
(
t
,
pair
.
second
++
));
return
t
;
}
return
pair
.
first
.
nextObject
();
},
std
::
make_pair
(
enumerator
,
0
));
},
std
::
make_pair
(
_
enumerator
,
0
));
}
LinqObj
<
Enumerator
<
T
,
std
::
pair
<
TE
,
int
>
>
>
skipWhile
(
std
::
function
<
bool
(
T
)
>
predicate
)
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment