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
Apr 14, 2015
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:
...
@@ -12,8 +12,8 @@ cdef extern from "<deque>" namespace "std" nogil:
iterator
operator
--
()
iterator
operator
--
()
bint
operator
==
(
reverse_iterator
)
bint
operator
==
(
reverse_iterator
)
bint
operator
!=
(
reverse_iterator
)
bint
operator
!=
(
reverse_iterator
)
#
cppclass const_iterator(iterator):
cppclass
const_iterator
(
iterator
):
#
pass
pass
#cppclass const_reverse_iterator(reverse_iterator):
#cppclass const_reverse_iterator(reverse_iterator):
# pass
# pass
deque
()
except
+
deque
()
except
+
...
@@ -34,11 +34,11 @@ cdef extern from "<deque>" namespace "std" nogil:
...
@@ -34,11 +34,11 @@ cdef extern from "<deque>" namespace "std" nogil:
T
&
at
(
size_t
)
T
&
at
(
size_t
)
T
&
back
()
T
&
back
()
iterator
begin
()
iterator
begin
()
#const_iterator begin
()
const_iterator
const_begin
"begin"
()
void
clear
()
void
clear
()
bint
empty
()
bint
empty
()
iterator
end
()
iterator
end
()
#const_iterator end
()
const_iterator
const_end
"end"
()
iterator
erase
(
iterator
)
iterator
erase
(
iterator
)
iterator
erase
(
iterator
,
iterator
)
iterator
erase
(
iterator
,
iterator
)
T
&
front
()
T
&
front
()
...
...
Cython/Includes/libcpp/vector.pxd
View file @
56491280
...
@@ -24,8 +24,8 @@ cdef extern from "<vector>" namespace "std" nogil:
...
@@ -24,8 +24,8 @@ cdef extern from "<vector>" namespace "std" nogil:
bint
operator
>
(
reverse_iterator
)
bint
operator
>
(
reverse_iterator
)
bint
operator
<=
(
reverse_iterator
)
bint
operator
<=
(
reverse_iterator
)
bint
operator
>=
(
reverse_iterator
)
bint
operator
>=
(
reverse_iterator
)
#
cppclass const_iterator(iterator):
cppclass
const_iterator
(
iterator
):
#
pass
pass
#cppclass const_reverse_iterator(reverse_iterator):
#cppclass const_reverse_iterator(reverse_iterator):
# pass
# pass
vector
()
except
+
vector
()
except
+
...
@@ -46,12 +46,12 @@ cdef extern from "<vector>" namespace "std" nogil:
...
@@ -46,12 +46,12 @@ cdef extern from "<vector>" namespace "std" nogil:
T
&
at
(
size_t
)
except
+
T
&
at
(
size_t
)
except
+
T
&
back
()
T
&
back
()
iterator
begin
()
iterator
begin
()
#const_iterator begin
()
const_iterator
const_begin
"begin"
()
size_t
capacity
()
size_t
capacity
()
void
clear
()
void
clear
()
bint
empty
()
bint
empty
()
iterator
end
()
iterator
end
()
#const_iterator end
()
const_iterator
const_end
"end"
()
iterator
erase
(
iterator
)
iterator
erase
(
iterator
)
iterator
erase
(
iterator
,
iterator
)
iterator
erase
(
iterator
,
iterator
)
T
&
front
()
T
&
front
()
...
@@ -70,7 +70,7 @@ cdef extern from "<vector>" namespace "std" nogil:
...
@@ -70,7 +70,7 @@ cdef extern from "<vector>" namespace "std" nogil:
void
resize
(
size_t
,
T
&
)
except
+
void
resize
(
size_t
,
T
&
)
except
+
size_t
size
()
size_t
size
()
void
swap
(
vector
&
)
void
swap
(
vector
&
)
# C++11 methods
# C++11 methods
T
*
data
()
T
*
data
()
void
shrink_to_fit
()
void
shrink_to_fit
()
tests/run/libcpp_all.pyx
View file @
56491280
# tag: cpp
# tag: cpp
import
cython
cimport
libcpp
cimport
libcpp
cimport
libcpp.deque
cimport
libcpp.deque
...
@@ -67,3 +69,23 @@ def test_vector_coercion(*args):
...
@@ -67,3 +69,23 @@ def test_vector_coercion(*args):
for
a
in
args
:
for
a
in
args
:
v
.
push_back
(
a
)
v
.
push_back
(
a
)
return
[
v
[
0
][
i
]
for
i
in
range
(
v
.
size
())]
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
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