Commit 2ef200bd authored by Robert Bradshaw's avatar Robert Bradshaw

Convert stl map conversion to take const ref.

parent 770acb7d
......@@ -8,14 +8,18 @@ cdef extern from "<map>" namespace "std" nogil:
iterator operator--()
bint operator==(iterator)
bint operator!=(iterator)
cppclass const_iterator:
pair[const T, U]& operator*()
const_iterator operator++()
const_iterator operator--()
bint operator==(const_iterator)
bint operator!=(const_iterator)
cppclass reverse_iterator:
pair[T, U]& operator*()
iterator operator++()
iterator operator--()
bint operator==(reverse_iterator)
bint operator!=(reverse_iterator)
#cppclass const_iterator(iterator):
# pass
#cppclass const_reverse_iterator(reverse_iterator):
# pass
map() except +
......@@ -31,19 +35,19 @@ cdef extern from "<map>" namespace "std" nogil:
bint operator>=(map&, map&)
U& at(T&)
iterator begin()
#const_iterator begin()
const_iterator const_begin "begin" ()
void clear()
size_t count(T&)
bint empty()
iterator end()
#const_iterator end()
const_iterator const_end "end" ()
pair[iterator, iterator] equal_range(T&)
#pair[const_iterator, const_iterator] equal_range(key_type&)
void erase(iterator)
void erase(iterator, iterator)
size_t erase(T&)
iterator find(T&)
#const_iterator find(key_type&)
const_iterator const_find "find" (T&)
pair[iterator, bint] insert(pair[T, U]) # XXX pair[T,U]&
iterator insert(iterator, pair[T, U]) # XXX pair[T,U]&
#void insert(input_iterator, input_iterator)
......
......@@ -213,18 +213,18 @@ cdef extern from *:
cppclass value_type:
T first
U second
cppclass iterator:
cppclass const_iterator:
value_type& operator*()
iterator operator++()
bint operator!=(iterator)
iterator begin()
iterator end()
const_iterator operator++()
bint operator!=(const_iterator)
const_iterator begin()
const_iterator end()
@cname("{{cname}}")
cdef object {{cname}}(map[X,Y] s):
cdef object {{cname}}(const map[X,Y]& s):
o = {}
cdef map[X,Y].value_type *key_value
cdef map[X,Y].iterator iter = s.begin()
cdef const map[X,Y].value_type *key_value
cdef map[X,Y].const_iterator iter = s.begin()
while iter != s.end():
key_value = &cython.operator.dereference(iter)
o[X_to_py(key_value.first)] = Y_to_py(key_value.second)
......
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