Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
4a4f6583
Commit
4a4f6583
authored
Jul 02, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
C++ iterator tests.
parent
2d177dda
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-0
tests/run/cpp_iterators.pyx
tests/run/cpp_iterators.pyx
+31
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
4a4f6583
...
...
@@ -2184,6 +2184,8 @@ class NextNode(AtomicExprNode):
self
.
type
=
iterator_type
.
base_type
elif
iterator_type
.
is_cpp_class
:
self
.
type
=
iterator_type
.
scope
.
lookup
(
"operator*"
).
type
.
base_type
.
return_type
if
self
.
type
.
is_reference
:
self
.
type
=
self
.
type
.
ref_base_type
else
:
self
.
type
=
py_object_type
self
.
is_temp
=
1
...
...
tests/run/cpp_iterators.pyx
0 → 100644
View file @
4a4f6583
# tag: cpp
from
libcpp.vector
cimport
vector
def
test_vector
(
py_v
):
"""
>>> test_vector([1, 2, 3])
[1, 2, 3]
"""
cdef
vector
[
int
]
v
=
py_v
cdef
vector
[
int
]
result
with
nogil
:
for
item
in
v
:
result
.
push_back
(
item
)
return
result
def
test_ptrs
():
"""
>>> test_ptrs()
[1.0, 2.0, 3.0]
"""
cdef
double
a
=
1
cdef
double
b
=
2
cdef
double
c
=
3
cdef
vector
[
double
*
]
v
v
.
push_back
(
&
a
)
v
.
push_back
(
&
b
)
v
.
push_back
(
&
c
)
cdef
double
*
item
return
[
item
[
0
]
for
item
in
v
]
\ No newline at end of file
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