Commit 85086530 authored by Valentin Valls's avatar Valentin Valls

Add const data to vector

parent ee1b0219
......@@ -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()
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment