Created
June 19, 2015 17:28
-
-
Save bmabey/6b2ea582fd4c8a463af9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# distutils: language=c++ | |
from libcpp.vector cimport vector | |
cdef extern from "<algorithm>" namespace "std": | |
iter std_find "std::find" [iter, T](iter first, iter last, const T& val) | |
cdef void remove(vector[int] vect, int elem): | |
vect.erase(std_find[vector[int].iterator, int](vect.begin(), vect.end(), elem)) | |
def blah(): | |
cdef vector[int] vect | |
cdef int i | |
for i in range(10): | |
vect.push_back(i) | |
for i in range(10): | |
print vect[i] | |
remove(vect, i) | |
return vect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment