summaryrefslogtreecommitdiff
path: root/tests/run/memview_vector.pyx
blob: ba5f65ed348def807e65a3044f374fce7a906fa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# mode: run
# tag: cpp

from libcpp.vector cimport vector

def memview_test(L, int i, int x):
    """
    >>> memview_test(range(10), 7, 100)
    [0, 1, 2, 3, 4, 5, 6, 100, 8, 9]
    """
    cdef vector[int] v = L
    cdef int[::1] mv = <int[:len(L)]> &v[0]
    mv[i] = x
    return v