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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
56491280
Commit
56491280
authored
9 years ago
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Declare const iterator accessors under another name.
parent
0921b9bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
9 deletions
+31
-9
Cython/Includes/libcpp/deque.pxd
Cython/Includes/libcpp/deque.pxd
+4
-4
Cython/Includes/libcpp/vector.pxd
Cython/Includes/libcpp/vector.pxd
+5
-5
tests/run/libcpp_all.pyx
tests/run/libcpp_all.pyx
+22
-0
No files found.
Cython/Includes/libcpp/deque.pxd
View file @
56491280
...
...
@@ -12,8 +12,8 @@ cdef extern from "<deque>" namespace "std" nogil:
iterator
operator
--
()
bint
operator
==
(
reverse_iterator
)
bint
operator
!=
(
reverse_iterator
)
#
cppclass const_iterator(iterator):
#
pass
cppclass
const_iterator
(
iterator
):
pass
#cppclass const_reverse_iterator(reverse_iterator):
# pass
deque
()
except
+
...
...
@@ -34,11 +34,11 @@ cdef extern from "<deque>" namespace "std" nogil:
T
&
at
(
size_t
)
T
&
back
()
iterator
begin
()
#const_iterator begin
()
const_iterator
const_begin
"begin"
()
void
clear
()
bint
empty
()
iterator
end
()
#const_iterator end
()
const_iterator
const_end
"end"
()
iterator
erase
(
iterator
)
iterator
erase
(
iterator
,
iterator
)
T
&
front
()
...
...
This diff is collapsed.
Click to expand it.
Cython/Includes/libcpp/vector.pxd
View file @
56491280
...
...
@@ -24,8 +24,8 @@ cdef extern from "<vector>" namespace "std" nogil:
bint
operator
>
(
reverse_iterator
)
bint
operator
<=
(
reverse_iterator
)
bint
operator
>=
(
reverse_iterator
)
#
cppclass const_iterator(iterator):
#
pass
cppclass
const_iterator
(
iterator
):
pass
#cppclass const_reverse_iterator(reverse_iterator):
# pass
vector
()
except
+
...
...
@@ -46,12 +46,12 @@ cdef extern from "<vector>" namespace "std" nogil:
T
&
at
(
size_t
)
except
+
T
&
back
()
iterator
begin
()
#const_iterator begin
()
const_iterator
const_begin
"begin"
()
size_t
capacity
()
void
clear
()
bint
empty
()
iterator
end
()
#const_iterator end
()
const_iterator
const_end
"end"
()
iterator
erase
(
iterator
)
iterator
erase
(
iterator
,
iterator
)
T
&
front
()
...
...
@@ -70,7 +70,7 @@ cdef extern from "<vector>" namespace "std" nogil:
void
resize
(
size_t
,
T
&
)
except
+
size_t
size
()
void
swap
(
vector
&
)
# C++11 methods
T
*
data
()
void
shrink_to_fit
()
This diff is collapsed.
Click to expand it.
tests/run/libcpp_all.pyx
View file @
56491280
# tag: cpp
import
cython
cimport
libcpp
cimport
libcpp.deque
...
...
@@ -67,3 +69,23 @@ def test_vector_coercion(*args):
for
a
in
args
:
v
.
push_back
(
a
)
return
[
v
[
0
][
i
]
for
i
in
range
(
v
.
size
())]
def
test_const_vector
(
*
args
):
"""
>>> test_const_vector(1.75)
[1.75]
>>> test_const_vector(1, 10, 100)
[1.0, 10.0, 100.0]
"""
cdef
vector
[
double
]
v
for
a
in
args
:
v
.
push_back
(
a
)
return
const_vector_to_list
(
v
)
cdef
const_vector_to_list
(
const
vector
[
double
]
&
cv
):
cdef
vector
[
double
].
const_iterator
iter
=
cv
.
const_begin
()
cdef
lst
=
[]
while
iter
!=
cv
.
const_end
():
lst
.
append
(
cython
.
operator
.
dereference
(
iter
))
cython
.
operator
.
preincrement
(
iter
)
return
lst
This diff is collapsed.
Click to expand it.
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