Commit a0d13cb1 authored by Stefan Behnel's avatar Stefan Behnel

Merge remote-tracking branch 'origin/master'

parents 346243fe 4e5f0365
......@@ -12,8 +12,8 @@ cdef extern from "<deque>" namespace "std" nogil:
iterator operator--()
bint operator==(reverse_iterator)
bint operator!=(reverse_iterator)
#cppclass const_iterator(iterator):
# pass
cppclass const_iterator(iterator):
pass
#cppclass const_reverse_iterator(reverse_iterator):
# pass
deque() except +
......@@ -34,11 +34,11 @@ cdef extern from "<deque>" namespace "std" nogil:
T& at(size_t)
T& back()
iterator begin()
#const_iterator begin()
const_iterator const_begin "begin"()
void clear()
bint empty()
iterator end()
#const_iterator end()
const_iterator const_end "end"()
iterator erase(iterator)
iterator erase(iterator, iterator)
T& front()
......
......@@ -16,10 +16,10 @@ cdef extern from "<list>" namespace "std" nogil:
reverse_iterator operator--()
bint operator==(reverse_iterator)
bint operator!=(reverse_iterator)
#cppclass const_iterator(iterator):
# pass
#cppclass const_reverse_iterator(reverse_iterator):
# pass
cppclass const_iterator(iterator):
pass
cppclass const_reverse_iterator(reverse_iterator):
pass
list() except +
list(list&) except +
list(size_t, T&) except +
......@@ -33,11 +33,11 @@ cdef extern from "<list>" namespace "std" nogil:
void assign(size_t, T&)
T& back()
iterator begin()
#const_iterator begin()
const_iterator const_begin "begin"()
void clear()
bint empty()
iterator end()
#const_iterator end()
const_iterator const_end "end"()
iterator erase(iterator)
iterator erase(iterator, iterator)
T& front()
......@@ -51,11 +51,11 @@ cdef extern from "<list>" namespace "std" nogil:
void push_back(T&)
void push_front(T&)
reverse_iterator rbegin()
#const_reverse_iterator rbegin()
const_reverse_iterator const_rbegin "rbegin"()
void remove(T&)
#void remove_if(UnPred)
reverse_iterator rend()
#const_reverse_iterator rend()
const_reverse_iterator const_rend "rend"()
void resize(size_t, T&)
void reverse()
size_t size()
......
......@@ -20,8 +20,8 @@ cdef extern from "<map>" namespace "std" nogil:
iterator operator--()
bint operator==(reverse_iterator)
bint operator!=(reverse_iterator)
#cppclass const_reverse_iterator(reverse_iterator):
# pass
cppclass const_reverse_iterator(reverse_iterator):
pass
map() except +
map(map&) except +
#map(key_compare&)
......@@ -53,14 +53,14 @@ cdef extern from "<map>" namespace "std" nogil:
#void insert(input_iterator, input_iterator)
#key_compare key_comp()
iterator lower_bound(const T&)
#const_iterator lower_bound(const key_type&)
const_iterator const_lower_bound "lower_bound"(const T&)
size_t max_size()
reverse_iterator rbegin()
#const_reverse_iterator rbegin()
const_reverse_iterator const_rbegin "rbegin"()
reverse_iterator rend()
#const_reverse_iterator rend()
const_reverse_iterator const_rend "rend"()
size_t size()
void swap(map&)
iterator upper_bound(const T&)
#const_iterator upper_bound(const key_type&)
const_iterator const_upper_bound "upper_bound"(const T&)
#value_compare value_comp()
......@@ -14,10 +14,10 @@ cdef extern from "<set>" namespace "std" nogil:
iterator operator--()
bint operator==(reverse_iterator)
bint operator!=(reverse_iterator)
#cppclass const_iterator(iterator):
# pass
#cppclass const_reverse_iterator(reverse_iterator):
# pass
cppclass const_iterator(iterator):
pass
cppclass const_reverse_iterator(reverse_iterator):
pass
set() except +
set(set&) except +
#set(key_compare&)
......@@ -29,32 +29,32 @@ cdef extern from "<set>" namespace "std" nogil:
bint operator<=(set&, set&)
bint operator>=(set&, set&)
iterator begin()
#const_iterator begin()
const_iterator const_begin "begin"()
void clear()
size_t count(const T&)
bint empty()
iterator end()
#const_iterator end()
const_iterator const_end "end"()
pair[iterator, iterator] equal_range(const T&)
#pair[const_iterator, const_iterator] equal_range(T&)
void erase(iterator)
void erase(iterator, iterator)
size_t erase(T&)
iterator find(T&)
#const_iterator find(T&)
const_iterator const_find "find"(T&)
pair[iterator, bint] insert(const T&) except +
iterator insert(iterator, const T&) except +
#void insert(input_iterator, input_iterator)
#key_compare key_comp()
iterator lower_bound(T&)
#const_iterator lower_bound(T&)
const_iterator const_lower_bound "lower_bound"(T&)
size_t max_size()
reverse_iterator rbegin()
#const_reverse_iterator rbegin()
const_reverse_iterator const_rbegin "rbegin"()
reverse_iterator rend()
#const_reverse_iterator rend()
const_reverse_iterator const_rend "rend"()
size_t size()
void swap(set&)
iterator upper_bound(const T&)
#const_iterator upper_bound(const T&)
const_iterator const_upper_bound "upper_bound"(const T&)
#value_compare value_comp()
......@@ -14,10 +14,10 @@ cdef extern from "<unordered_map>" namespace "std" nogil:
iterator operator--()
bint operator==(reverse_iterator)
bint operator!=(reverse_iterator)
#cppclass const_iterator(iterator):
# pass
#cppclass const_reverse_iterator(reverse_iterator):
# pass
cppclass const_iterator(iterator):
pass
cppclass const_reverse_iterator(reverse_iterator):
pass
unordered_map() except +
unordered_map(unordered_map&) except +
#unordered_map(key_compare&)
......@@ -31,34 +31,34 @@ cdef extern from "<unordered_map>" namespace "std" nogil:
bint operator>=(unordered_map&, unordered_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)
#key_compare key_comp()
iterator lower_bound(T&)
#const_iterator lower_bound(key_type&)
const_iterator const_lower_bound "lower_bound"(T&)
size_t max_size()
reverse_iterator rbegin()
#const_reverse_iterator rbegin()
const_reverse_iterator const_rbegin "rbegin"()
reverse_iterator rend()
#const_reverse_iterator rend()
const_reverse_iterator const_rend "rend"()
size_t size()
void swap(unordered_map&)
iterator upper_bound(T&)
#const_iterator upper_bound(key_type&)
const_iterator const_upper_bound "upper_bound"(T&)
#value_compare value_comp()
void max_load_factor(float)
float max_load_factor()
......@@ -14,10 +14,10 @@ cdef extern from "<unordered_set>" namespace "std" nogil:
iterator operator--()
bint operator==(reverse_iterator)
bint operator!=(reverse_iterator)
#cppclass const_iterator(iterator):
# pass
#cppclass const_reverse_iterator(reverse_iterator):
# pass
cppclass const_iterator(iterator):
pass
cppclass const_reverse_iterator(reverse_iterator):
pass
unordered_set() except +
unordered_set(unordered_set&) except +
#unordered_set(key_compare&)
......@@ -29,32 +29,32 @@ cdef extern from "<unordered_set>" namespace "std" nogil:
bint operator<=(unordered_set&, unordered_set&)
bint operator>=(unordered_set&, unordered_set&)
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(T&)
void erase(iterator)
void erase(iterator, iterator)
size_t erase(T&)
iterator find(T&)
#const_iterator find(T&)
const_iterator const_find "find"(T&)
pair[iterator, bint] insert(T&)
iterator insert(iterator, T&)
#void insert(input_iterator, input_iterator)
#key_compare key_comp()
iterator lower_bound(T&)
#const_iterator lower_bound(T&)
const_iterator const_lower_bound "lower_bound"(T&)
size_t max_size()
reverse_iterator rbegin()
#const_reverse_iterator rbegin()
const_reverse_iterator const_rbegin "rbegin"()
reverse_iterator rend()
#const_reverse_iterator rend()
const_reverse_iterator const_rend "rend"()
size_t size()
void swap(unordered_set&)
iterator upper_bound(T&)
#const_iterator upper_bound(T&)
const_iterator const_upper_bound "upper_bound"(T&)
#value_compare value_comp()
......@@ -24,10 +24,10 @@ cdef extern from "<vector>" namespace "std" nogil:
bint operator>(reverse_iterator)
bint operator<=(reverse_iterator)
bint operator>=(reverse_iterator)
#cppclass const_iterator(iterator):
# pass
#cppclass const_reverse_iterator(reverse_iterator):
# pass
cppclass const_iterator(iterator):
pass
cppclass const_reverse_iterator(reverse_iterator):
pass
vector() except +
vector(vector&) except +
vector(size_t) except +
......@@ -46,12 +46,12 @@ cdef extern from "<vector>" namespace "std" nogil:
T& at(size_t) except +
T& back()
iterator begin()
#const_iterator begin()
const_iterator const_begin "begin"()
size_t capacity()
void clear()
bint empty()
iterator end()
#const_iterator end()
const_iterator const_end "end"()
iterator erase(iterator)
iterator erase(iterator, iterator)
T& front()
......@@ -62,15 +62,15 @@ cdef extern from "<vector>" namespace "std" nogil:
void pop_back()
void push_back(T&) except +
reverse_iterator rbegin()
#const_reverse_iterator rbegin()
const_reverse_iterator const_rbegin "rbegin"()
reverse_iterator rend()
#const_reverse_iterator rend()
const_reverse_iterator const_rend "rend"()
void reserve(size_t)
void resize(size_t) except +
void resize(size_t, T&) except +
size_t size()
void swap(vector&)
# C++11 methods
T* data()
void shrink_to_fit()
# tag: cpp
import cython
cimport libcpp
cimport libcpp.deque
......@@ -67,3 +69,23 @@ def test_vector_coercion(*args):
for a in args:
v.push_back(a)
return [v[0][i] for i in range(v.size())]
def test_const_vector(*args):
"""
>>> test_const_vector(1.75)
[1.75]
>>> test_const_vector(1, 10, 100)
[1.0, 10.0, 100.0]
"""
cdef vector[double] v
for a in args:
v.push_back(a)
return const_vector_to_list(v)
cdef const_vector_to_list(const vector[double]& cv):
cdef vector[double].const_iterator iter = cv.const_begin()
cdef lst = []
while iter != cv.const_end():
lst.append(cython.operator.dereference(iter))
cython.operator.preincrement(iter)
return lst
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