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
85086530
Commit
85086530
authored
Apr 20, 2018
by
Valentin Valls
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add const data to vector
parent
ee1b0219
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
Cython/Includes/libcpp/vector.pxd
Cython/Includes/libcpp/vector.pxd
+1
-0
tests/run/cpp_stl_cpp11.pyx
tests/run/cpp_stl_cpp11.pyx
+20
-0
No files found.
Cython/Includes/libcpp/vector.pxd
View file @
85086530
...
...
@@ -84,4 +84,5 @@ cdef extern from "<vector>" namespace "std" nogil:
# C++11 methods
T
*
data
()
const
T
*
const_data
"data"
()
void
shrink_to_fit
()
tests/run/cpp_stl_cpp11.pyx
View file @
85086530
...
...
@@ -4,8 +4,28 @@
import
sys
from
libcpp.unordered_map
cimport
unordered_map
from
libcpp.vector
cimport
vector
from
libcpp.vector
cimport
vector
from
libcpp.pair
cimport
pair
def
test_vector_functionality
():
"""
>>> test_vector_functionality()
'pass'
"""
cdef
:
vector
[
int
]
int_vector
=
vector
[
int
]()
int
*
data
const
int
*
const_data
int_vector
.
push_back
(
77
)
data
=
int_vector
.
data
()
const_data
=
int_vector
.
const_data
()
assert
data
[
0
]
==
77
assert
const_data
[
0
]
==
77
return
"pass"
def
test_unordered_map_functionality
():
"""
>>> test_unordered_map_functionality()
...
...
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