Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
daed1abc
Commit
daed1abc
authored
Jun 17, 2016
by
Ivan Smirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to using prefix increment in make_iterator
parent
3ae5bd78
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
include/pybind11/pybind11.h
+10
-3
No files found.
include/pybind11/pybind11.h
View file @
daed1abc
...
@@ -1028,7 +1028,10 @@ PYBIND11_NOINLINE inline void keep_alive_impl(int Nurse, int Patient, handle arg
...
@@ -1028,7 +1028,10 @@ PYBIND11_NOINLINE inline void keep_alive_impl(int Nurse, int Patient, handle arg
(
void
)
wr
.
release
();
(
void
)
wr
.
release
();
}
}
template
<
typename
Iterator
>
struct
iterator_state
{
Iterator
it
,
end
;
};
template
<
typename
Iterator
>
struct
iterator_state
{
Iterator
it
,
end
;
bool
first
;
};
NAMESPACE_END
(
detail
)
NAMESPACE_END
(
detail
)
...
@@ -1044,13 +1047,17 @@ iterator make_iterator(Iterator first, Iterator last, Extra &&... extra) {
...
@@ -1044,13 +1047,17 @@ iterator make_iterator(Iterator first, Iterator last, Extra &&... extra) {
class_
<
state
>
(
handle
(),
""
)
class_
<
state
>
(
handle
(),
""
)
.
def
(
"__iter__"
,
[](
state
&
s
)
->
state
&
{
return
s
;
})
.
def
(
"__iter__"
,
[](
state
&
s
)
->
state
&
{
return
s
;
})
.
def
(
"__next__"
,
[](
state
&
s
)
->
ValueType
{
.
def
(
"__next__"
,
[](
state
&
s
)
->
ValueType
{
if
(
!
s
.
first
)
++
s
.
it
;
else
s
.
first
=
false
;
if
(
s
.
it
==
s
.
end
)
if
(
s
.
it
==
s
.
end
)
throw
stop_iteration
();
throw
stop_iteration
();
return
*
s
.
it
++
;
return
*
s
.
it
;
},
return_value_policy
::
reference_internal
,
std
::
forward
<
Extra
>
(
extra
)...);
},
return_value_policy
::
reference_internal
,
std
::
forward
<
Extra
>
(
extra
)...);
}
}
return
(
iterator
)
cast
(
state
{
first
,
last
});
return
(
iterator
)
cast
(
state
{
first
,
last
,
true
});
}
}
template
<
typename
Type
,
typename
...
Extra
>
iterator
make_iterator
(
Type
&
value
,
Extra
&&
...
extra
)
{
template
<
typename
Type
,
typename
...
Extra
>
iterator
make_iterator
(
Type
&
value
,
Extra
&&
...
extra
)
{
...
...
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