Skip to content

Instantly share code, notes, and snippets.

@bmabey
Created June 19, 2015 17:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmabey/6b2ea582fd4c8a463af9 to your computer and use it in GitHub Desktop.
Save bmabey/6b2ea582fd4c8a463af9 to your computer and use it in GitHub Desktop.
0
1
2
3
4
5
6
7
8
9
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
# 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