Commit 731f1925 authored by Xavier Thompson's avatar Xavier Thompson

Fix list membership test

parent e1949632
......@@ -19,3 +19,11 @@ cdef extern from * nogil:
list_iterator_t operator++()
bint operator!=(base_iterator_t)
# Needed to implement "value in list" test for template list
cdef extern from "<functional>" namespace "std" nogil:
cdef cppclass equal_to[T=*]:
# https://github.com/cython/cython/issues/3193
equal_to() except +
bint operator()(const T& lhs, const T& rhs) except +
......@@ -118,7 +118,7 @@ cdef cypclass List[V]:
bint __contains__(const self, const value_type value):
for v in self._elements:
if value is v:
if equal_to[value_type]()(value, v):
return 1
return 0
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