Created
June 19, 2015 17:28
-
-
Save bmabey/6b2ea582fd4c8a463af9 to your computer and use it in GitHub Desktop.
Revisions
-
bmabey created this gist
Jun 19, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ # 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