diff options
author | scoder <stefan_ml@behnel.de> | 2018-08-11 12:04:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-11 12:04:53 +0200 |
commit | bd0a2c6b34b8e7b2181fa24e9774e65fc6311edd (patch) | |
tree | f09219113c7a881a7a7929c7cc4910c3f920a026 /Cython/Includes/libcpp | |
parent | cd6113fc02aa150a386ba3cb1084f1a792338d22 (diff) | |
parent | b213375c4b76f0f59abb42675a4f42d922e23583 (diff) | |
download | cython-bd0a2c6b34b8e7b2181fa24e9774e65fc6311edd.tar.gz |
Merge pull request #2207 from vallsv/improve-cpp11-containers
Improve C++11 containers
Diffstat (limited to 'Cython/Includes/libcpp')
-rw-r--r-- | Cython/Includes/libcpp/deque.pxd | 3 | ||||
-rw-r--r-- | Cython/Includes/libcpp/map.pxd | 9 | ||||
-rw-r--r-- | Cython/Includes/libcpp/queue.pxd | 5 | ||||
-rw-r--r-- | Cython/Includes/libcpp/set.pxd | 6 | ||||
-rw-r--r-- | Cython/Includes/libcpp/unordered_map.pxd | 11 | ||||
-rw-r--r-- | Cython/Includes/libcpp/unordered_set.pxd | 16 | ||||
-rw-r--r-- | Cython/Includes/libcpp/vector.pxd | 1 |
7 files changed, 35 insertions, 16 deletions
diff --git a/Cython/Includes/libcpp/deque.pxd b/Cython/Includes/libcpp/deque.pxd index 675cf595d..9e2b2291d 100644 --- a/Cython/Includes/libcpp/deque.pxd +++ b/Cython/Includes/libcpp/deque.pxd @@ -81,3 +81,6 @@ cdef extern from "<deque>" namespace "std" nogil: void resize(size_t, T&) size_t size() void swap(deque&) + + # C++11 methods + void shrink_to_fit() diff --git a/Cython/Includes/libcpp/map.pxd b/Cython/Includes/libcpp/map.pxd index b0325dca1..624a7ac02 100644 --- a/Cython/Includes/libcpp/map.pxd +++ b/Cython/Includes/libcpp/map.pxd @@ -13,18 +13,14 @@ 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 + @@ -39,6 +35,7 @@ cdef extern from "<map>" namespace "std" nogil: bint operator<=(map&, map&) bint operator>=(map&, map&) U& at(const T&) except + + const U& const_at "at"(const T&) except + iterator begin() const_iterator const_begin "begin" () void clear() diff --git a/Cython/Includes/libcpp/queue.pxd b/Cython/Includes/libcpp/queue.pxd index 3ef1997c3..578cbd915 100644 --- a/Cython/Includes/libcpp/queue.pxd +++ b/Cython/Includes/libcpp/queue.pxd @@ -9,6 +9,9 @@ cdef extern from "<queue>" namespace "std" nogil: void pop() void push(T&) size_t size() + # C++11 methods + void swap(queue&) + cdef cppclass priority_queue[T]: priority_queue() except + priority_queue(priority_queue&) except + @@ -18,3 +21,5 @@ cdef extern from "<queue>" namespace "std" nogil: void push(T&) size_t size() T& top() + # C++11 methods + void swap(priority_queue&) diff --git a/Cython/Includes/libcpp/set.pxd b/Cython/Includes/libcpp/set.pxd index cca54b4ea..1069be746 100644 --- a/Cython/Includes/libcpp/set.pxd +++ b/Cython/Includes/libcpp/set.pxd @@ -38,14 +38,14 @@ cdef extern from "<set>" namespace "std" nogil: 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) + iterator erase(iterator) + iterator erase(iterator, iterator) size_t erase(T&) 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) + void insert(iterator, iterator) except + #key_compare key_comp() iterator lower_bound(T&) const_iterator const_lower_bound "lower_bound"(T&) diff --git a/Cython/Includes/libcpp/unordered_map.pxd b/Cython/Includes/libcpp/unordered_map.pxd index 6f373630e..329c1cefd 100644 --- a/Cython/Includes/libcpp/unordered_map.pxd +++ b/Cython/Includes/libcpp/unordered_map.pxd @@ -32,7 +32,8 @@ cdef extern from "<unordered_map>" namespace "std" nogil: bint operator>(unordered_map&, unordered_map&) bint operator<=(unordered_map&, unordered_map&) bint operator>=(unordered_map&, unordered_map&) - U& at(T&) + U& at(const T&) + const U& const_at "at"(const T&) iterator begin() const_iterator const_begin "begin"() void clear() @@ -41,7 +42,7 @@ cdef extern from "<unordered_map>" namespace "std" nogil: iterator end() const_iterator const_end "end"() pair[iterator, iterator] equal_range(T&) - #pair[const_iterator, const_iterator] equal_range(key_type&) + pair[const_iterator, const_iterator] const_equal_range "equal_range"(const T&) iterator erase(iterator) iterator erase(iterator, iterator) size_t erase(T&) @@ -49,7 +50,7 @@ cdef extern from "<unordered_map>" namespace "std" nogil: 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) + iterator insert(iterator, iterator) #key_compare key_comp() iterator lower_bound(T&) const_iterator const_lower_bound "lower_bound"(T&) @@ -65,5 +66,9 @@ cdef extern from "<unordered_map>" namespace "std" nogil: #value_compare value_comp() void max_load_factor(float) float max_load_factor() + void rehash(size_t) void reserve(size_t) size_t bucket_count() + size_t max_bucket_count() + size_t bucket_size(size_t) + size_t bucket(const T&) diff --git a/Cython/Includes/libcpp/unordered_set.pxd b/Cython/Includes/libcpp/unordered_set.pxd index b4388c245..5aa241752 100644 --- a/Cython/Includes/libcpp/unordered_set.pxd +++ b/Cython/Includes/libcpp/unordered_set.pxd @@ -37,16 +37,16 @@ cdef extern from "<unordered_set>" namespace "std" nogil: 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) + pair[const_iterator, const_iterator] const_equal_range "equal_range"(T&) + iterator erase(iterator) + iterator erase(iterator, iterator) size_t erase(T&) 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 insert(iterator, iterator) iterator lower_bound(T&) const_iterator const_lower_bound "lower_bound"(T&) size_t max_size() @@ -59,3 +59,11 @@ cdef extern from "<unordered_set>" namespace "std" nogil: iterator upper_bound(T&) const_iterator const_upper_bound "upper_bound"(T&) #value_compare value_comp() + void max_load_factor(float) + float max_load_factor() + void rehash(size_t) + void reserve(size_t) + size_t bucket_count() + size_t max_bucket_count() + size_t bucket_size(size_t) + size_t bucket(const T&) diff --git a/Cython/Includes/libcpp/vector.pxd b/Cython/Includes/libcpp/vector.pxd index 0c03762e3..9b007dd0c 100644 --- a/Cython/Includes/libcpp/vector.pxd +++ b/Cython/Includes/libcpp/vector.pxd @@ -84,4 +84,5 @@ cdef extern from "<vector>" namespace "std" nogil: # C++11 methods T* data() + const T* const_data "data"() void shrink_to_fit() |