diff options
23 files changed, 723 insertions, 128 deletions
diff --git a/include/map b/include/map index 9f1c8a7e8..c0bc78413 100644 --- a/include/map +++ b/include/map @@ -84,29 +84,29 @@ public: noexcept( allocator_type::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<allocator_type>::value && - is_nothrow_move_assignable<keycompare>::value); + is_nothrow_move_assignable<key_compare>::value); map& operator=(initializer_list<value_type> il); // iterators: - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; - reverse_iterator rbegin(); - const_reverse_iterator rbegin() const; - reverse_iterator rend(); - const_reverse_iterator rend() const; + reverse_iterator rbegin() noexcept; + const_reverse_iterator rbegin() const noexcept; + reverse_iterator rend() noexcept; + const_reverse_iterator rend() const noexcept; - const_iterator cbegin() const; - const_iterator cend() const; - const_reverse_iterator crbegin() const; - const_reverse_iterator crend() const; + const_iterator cbegin() const noexcept; + const_iterator cend() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator crend() const noexcept; // capacity: - bool empty() const; - size_type size() const; - size_type max_size() const; + bool empty() const noexcept; + size_type size() const noexcept; + size_type max_size() const noexcept; // element access: mapped_type& operator[](const key_type& k); @@ -133,7 +133,7 @@ public: iterator erase(const_iterator position); size_type erase(const key_type& k); iterator erase(const_iterator first, const_iterator last); - void clear(); + void clear() noexcept; void swap(map& m) noexcept( @@ -142,7 +142,7 @@ public: __is_nothrow_swappable<allocator_type>::value)); // observers: - allocator_type get_allocator() const; + allocator_type get_allocator() const noexcept; key_compare key_comp() const; value_compare value_comp() const; @@ -259,29 +259,29 @@ public: noexcept( allocator_type::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<allocator_type>::value && - is_nothrow_move_assignable<keycompare>::value); + is_nothrow_move_assignable<key_compare>::value); multimap& operator=(initializer_list<value_type> il); // iterators: - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; - reverse_iterator rbegin(); - const_reverse_iterator rbegin() const; - reverse_iterator rend(); - const_reverse_iterator rend() const; + reverse_iterator rbegin() noexcept; + const_reverse_iterator rbegin() const noexcept; + reverse_iterator rend() noexcept; + const_reverse_iterator rend() const noexcept; - const_iterator cbegin() const; - const_iterator cend() const; - const_reverse_iterator crbegin() const; - const_reverse_iterator crend() const; + const_iterator cbegin() const noexcept; + const_iterator cend() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator crend() const noexcept; // capacity: - bool empty() const; - size_type size() const; - size_type max_size() const; + bool empty() const noexcept; + size_type size() const noexcept; + size_type max_size() const noexcept; // modifiers: template <class... Args> @@ -301,7 +301,7 @@ public: iterator erase(const_iterator position); size_type erase(const key_type& k); iterator erase(const_iterator first, const_iterator last); - void clear(); + void clear() noexcept; void swap(multimap& m) noexcept( @@ -310,7 +310,7 @@ public: __is_nothrow_swappable<allocator_type>::value)); // observers: - allocator_type get_allocator() const; + allocator_type get_allocator() const noexcept; key_compare key_comp() const; value_compare value_comp() const; diff --git a/include/set b/include/set index 7e2cdc0de..0f8a19adf 100644 --- a/include/set +++ b/include/set @@ -42,7 +42,12 @@ public: typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // construct/copy/destroy: - explicit set(const value_compare& comp = value_compare()); + set() + noexcept( + is_nothrow_default_constructible<allocator_type>::value && + is_nothrow_default_constructible<key_compare>::value && + is_nothrow_copy_constructible<key_compare>::value); + explicit set(const value_compare& comp); set(const value_compare& comp, const allocator_type& a); template <class InputIterator> set(InputIterator first, InputIterator last, @@ -51,7 +56,10 @@ public: set(InputIterator first, InputIterator last, const value_compare& comp, const allocator_type& a); set(const set& s); - set(set&& s); + set(set&& s) + noexcept( + is_nothrow_move_constructible<allocator_type>::value && + is_nothrow_move_constructible<key_compare>::value); explicit set(const allocator_type& a); set(const set& s, const allocator_type& a); set(set&& s, const allocator_type& a); @@ -61,29 +69,33 @@ public: ~set(); set& operator=(const set& s); - set& operator=(set&& s); + set& operator=(set&& s) + noexcept( + allocator_type::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable<allocator_type>::value && + is_nothrow_move_assignable<key_compare>::value); set& operator=(initializer_list<value_type> il); // iterators: - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; - reverse_iterator rbegin(); - const_reverse_iterator rbegin() const; - reverse_iterator rend(); - const_reverse_iterator rend() const; + reverse_iterator rbegin() noexcept; + const_reverse_iterator rbegin() const noexcept; + reverse_iterator rend() noexcept; + const_reverse_iterator rend() const noexcept; - const_iterator cbegin() const; - const_iterator cend() const; - const_reverse_iterator crbegin() const; - const_reverse_iterator crend() const; + const_iterator cbegin() const noexcept; + const_iterator cend() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator crend() const noexcept; // capacity: - bool empty() const; - size_type size() const; - size_type max_size() const; + bool empty() const noexcept; + size_type size() const noexcept; + size_type max_size() const noexcept; // modifiers: template <class... Args> @@ -101,12 +113,16 @@ public: iterator erase(const_iterator position); size_type erase(const key_type& k); iterator erase(const_iterator first, const_iterator last); - void clear(); + void clear() noexcept; - void swap(set& s); + void swap(set& s) + noexcept( + __is_nothrow_swappable<key_compare>::value && + (!allocator_type::propagate_on_container_swap::value || + __is_nothrow_swappable<allocator_type>::value)); // observers: - allocator_type get_allocator() const; + allocator_type get_allocator() const noexcept; key_compare key_comp() const; value_compare value_comp() const; @@ -155,7 +171,8 @@ operator<=(const set<Key, Compare, Allocator>& x, // specialized algorithms: template <class Key, class Compare, class Allocator> void -swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y); +swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y) + noexcept(noexcept(x.swap(y))); template <class Key, class Compare = less<Key>, class Allocator = allocator<Key>> @@ -181,7 +198,12 @@ public: typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // construct/copy/destroy: - explicit multiset(const value_compare& comp = value_compare()); + multiset() + noexcept( + is_nothrow_default_constructible<allocator_type>::value && + is_nothrow_default_constructible<key_compare>::value && + is_nothrow_copy_constructible<key_compare>::value); + explicit multiset(const value_compare& comp); multiset(const value_compare& comp, const allocator_type& a); template <class InputIterator> multiset(InputIterator first, InputIterator last, @@ -190,7 +212,10 @@ public: multiset(InputIterator first, InputIterator last, const value_compare& comp, const allocator_type& a); multiset(const multiset& s); - multiset(multiset&& s); + multiset(multiset&& s) + noexcept( + is_nothrow_move_constructible<allocator_type>::value && + is_nothrow_move_constructible<key_compare>::value); explicit multiset(const allocator_type& a); multiset(const multiset& s, const allocator_type& a); multiset(multiset&& s, const allocator_type& a); @@ -200,29 +225,33 @@ public: ~multiset(); multiset& operator=(const multiset& s); - multiset& operator=(multiset&& s); + multiset& operator=(multiset&& s) + noexcept( + allocator_type::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable<allocator_type>::value && + is_nothrow_move_assignable<key_compare>::value); multiset& operator=(initializer_list<value_type> il); // iterators: - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; + iterator begin() noexcept; + const_iterator begin() const noexcept; + iterator end() noexcept; + const_iterator end() const noexcept; - reverse_iterator rbegin(); - const_reverse_iterator rbegin() const; - reverse_iterator rend(); - const_reverse_iterator rend() const; + reverse_iterator rbegin() noexcept; + const_reverse_iterator rbegin() const noexcept; + reverse_iterator rend() noexcept; + const_reverse_iterator rend() const noexcept; - const_iterator cbegin() const; - const_iterator cend() const; - const_reverse_iterator crbegin() const; - const_reverse_iterator crend() const; + const_iterator cbegin() const noexcept; + const_iterator cend() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator crend() const noexcept; // capacity: - bool empty() const; - size_type size() const; - size_type max_size() const; + bool empty() const noexcept; + size_type size() const noexcept; + size_type max_size() const noexcept; // modifiers: template <class... Args> @@ -240,12 +269,16 @@ public: iterator erase(const_iterator position); size_type erase(const key_type& k); iterator erase(const_iterator first, const_iterator last); - void clear(); + void clear() noexcept; - void swap(multiset& s); + void swap(multiset& s) + noexcept( + __is_nothrow_swappable<key_compare>::value && + (!allocator_type::propagate_on_container_swap::value || + __is_nothrow_swappable<allocator_type>::value)); // observers: - allocator_type get_allocator() const; + allocator_type get_allocator() const noexcept; key_compare key_comp() const; value_compare value_comp() const; @@ -294,7 +327,8 @@ operator<=(const multiset<Key, Compare, Allocator>& x, // specialized algorithms: template <class Key, class Compare, class Allocator> void -swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y); +swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y) + noexcept(noexcept(x.swap(y))); } // std @@ -341,6 +375,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit set(const value_compare& __comp = value_compare()) + _NOEXCEPT_( + is_nothrow_default_constructible<allocator_type>::value && + is_nothrow_default_constructible<key_compare>::value && + is_nothrow_copy_constructible<key_compare>::value) : __tree_(__comp) {} _LIBCPP_INLINE_VISIBILITY set(const value_compare& __comp, const allocator_type& __a) @@ -373,6 +411,7 @@ public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY set(set&& __s) + _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_STD::move(__s.__tree_)) {} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -416,6 +455,7 @@ public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY set& operator=(set&& __s) + _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) { __tree_ = _STD::move(__s.__tree_); return *this; @@ -423,38 +463,42 @@ public: #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - iterator begin() {return __tree_.begin();} + iterator begin() _NOEXCEPT {return __tree_.begin();} _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const {return __tree_.begin();} + const_iterator begin() const _NOEXCEPT {return __tree_.begin();} _LIBCPP_INLINE_VISIBILITY - iterator end() {return __tree_.end();} + iterator end() _NOEXCEPT {return __tree_.end();} _LIBCPP_INLINE_VISIBILITY - const_iterator end() const {return __tree_.end();} + const_iterator end() const _NOEXCEPT {return __tree_.end();} _LIBCPP_INLINE_VISIBILITY - reverse_iterator rbegin() {return reverse_iterator(end());} + reverse_iterator rbegin() _NOEXCEPT + {return reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rbegin() const {return const_reverse_iterator(end());} + const_reverse_iterator rbegin() const _NOEXCEPT + {return const_reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY - reverse_iterator rend() {return reverse_iterator(begin());} + reverse_iterator rend() _NOEXCEPT + {return reverse_iterator(begin());} _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rend() const {return const_reverse_iterator(begin());} + const_reverse_iterator rend() const _NOEXCEPT + {return const_reverse_iterator(begin());} _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const {return begin();} + const_iterator cbegin() const _NOEXCEPT {return begin();} _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const {return end();} + const_iterator cend() const _NOEXCEPT {return end();} _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crbegin() const {return rbegin();} + const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crend() const {return rend();} + const_reverse_iterator crend() const _NOEXCEPT {return rend();} _LIBCPP_INLINE_VISIBILITY - bool empty() const {return __tree_.size() == 0;} + bool empty() const _NOEXCEPT {return __tree_.size() == 0;} _LIBCPP_INLINE_VISIBILITY - size_type size() const {return __tree_.size();} + size_type size() const _NOEXCEPT {return __tree_.size();} _LIBCPP_INLINE_VISIBILITY - size_type max_size() const {return __tree_.max_size();} + size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) @@ -504,13 +548,14 @@ public: iterator erase(const_iterator __f, const_iterator __l) {return __tree_.erase(__f, __l);} _LIBCPP_INLINE_VISIBILITY - void clear() {__tree_.clear();} + void clear() _NOEXCEPT {__tree_.clear();} _LIBCPP_INLINE_VISIBILITY - void swap(set& __s) {__tree_.swap(__s.__tree_);} + void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) + {__tree_.swap(__s.__tree_);} _LIBCPP_INLINE_VISIBILITY - allocator_type get_allocator() const {return __tree_.__alloc();} + allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();} _LIBCPP_INLINE_VISIBILITY key_compare key_comp() const {return __tree_.value_comp();} _LIBCPP_INLINE_VISIBILITY @@ -620,6 +665,7 @@ inline _LIBCPP_INLINE_VISIBILITY void swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y) + _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { __x.swap(__y); } @@ -658,6 +704,10 @@ public: // construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY explicit multiset(const value_compare& __comp = value_compare()) + _NOEXCEPT_( + is_nothrow_default_constructible<allocator_type>::value && + is_nothrow_default_constructible<key_compare>::value && + is_nothrow_copy_constructible<key_compare>::value) : __tree_(__comp) {} _LIBCPP_INLINE_VISIBILITY multiset(const value_compare& __comp, const allocator_type& __a) @@ -691,6 +741,7 @@ public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY multiset(multiset&& __s) + _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_STD::move(__s.__tree_)) {} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY @@ -731,6 +782,7 @@ public: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY multiset& operator=(multiset&& __s) + _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) { __tree_ = _STD::move(__s.__tree_); return *this; @@ -738,38 +790,42 @@ public: #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - iterator begin() {return __tree_.begin();} + iterator begin() _NOEXCEPT {return __tree_.begin();} _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const {return __tree_.begin();} + const_iterator begin() const _NOEXCEPT {return __tree_.begin();} _LIBCPP_INLINE_VISIBILITY - iterator end() {return __tree_.end();} + iterator end() _NOEXCEPT {return __tree_.end();} _LIBCPP_INLINE_VISIBILITY - const_iterator end() const {return __tree_.end();} + const_iterator end() const _NOEXCEPT {return __tree_.end();} _LIBCPP_INLINE_VISIBILITY - reverse_iterator rbegin() {return reverse_iterator(end());} + reverse_iterator rbegin() _NOEXCEPT + {return reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rbegin() const {return const_reverse_iterator(end());} + const_reverse_iterator rbegin() const _NOEXCEPT + {return const_reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY - reverse_iterator rend() {return reverse_iterator(begin());} + reverse_iterator rend() _NOEXCEPT + {return reverse_iterator(begin());} _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator rend() const {return const_reverse_iterator(begin());} + const_reverse_iterator rend() const _NOEXCEPT + {return const_reverse_iterator(begin());} _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const {return begin();} + const_iterator cbegin() const _NOEXCEPT {return begin();} _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const {return end();} + const_iterator cend() const _NOEXCEPT {return end();} _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crbegin() const {return rbegin();} + const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} _LIBCPP_INLINE_VISIBILITY - const_reverse_iterator crend() const {return rend();} + const_reverse_iterator crend() const _NOEXCEPT {return rend();} _LIBCPP_INLINE_VISIBILITY - bool empty() const {return __tree_.size() == 0;} + bool empty() const _NOEXCEPT {return __tree_.size() == 0;} _LIBCPP_INLINE_VISIBILITY - size_type size() const {return __tree_.size();} + size_type size() const _NOEXCEPT {return __tree_.size();} _LIBCPP_INLINE_VISIBILITY - size_type max_size() const {return __tree_.max_size();} + size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) @@ -818,13 +874,15 @@ public: iterator erase(const_iterator __f, const_iterator __l) {return __tree_.erase(__f, __l);} _LIBCPP_INLINE_VISIBILITY - void clear() {__tree_.clear();} + void clear() _NOEXCEPT {__tree_.clear();} _LIBCPP_INLINE_VISIBILITY - void swap(multiset& __s) {__tree_.swap(__s.__tree_);} + void swap(multiset& __s) + _NOEXCEPT_(__is_nothrow_swappable<__base>::value) + {__tree_.swap(__s.__tree_);} _LIBCPP_INLINE_VISIBILITY - allocator_type get_allocator() const {return __tree_.__alloc();} + allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();} _LIBCPP_INLINE_VISIBILITY key_compare key_comp() const {return __tree_.value_comp();} _LIBCPP_INLINE_VISIBILITY @@ -933,6 +991,7 @@ inline _LIBCPP_INLINE_VISIBILITY void swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y) + _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { __x.swap(__y); } diff --git a/test/containers/associative/map/map.cons/default_noexcept.pass.cpp b/test/containers/associative/map/map.cons/default_noexcept.pass.cpp index 4e497b92a..d673c6d67 100644 --- a/test/containers/associative/map/map.cons/default_noexcept.pass.cpp +++ b/test/containers/associative/map/map.cons/default_noexcept.pass.cpp @@ -42,7 +42,7 @@ int main() static_assert(std::is_nothrow_default_constructible<C>::value, ""); } { - typedef std::map<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; static_assert(!std::is_nothrow_default_constructible<C>::value, ""); } { diff --git a/test/containers/associative/map/map.cons/dtor_noexcept.pass.cpp b/test/containers/associative/map/map.cons/dtor_noexcept.pass.cpp index c3b99707c..a563371ac 100644 --- a/test/containers/associative/map/map.cons/dtor_noexcept.pass.cpp +++ b/test/containers/associative/map/map.cons/dtor_noexcept.pass.cpp @@ -40,7 +40,7 @@ int main() static_assert(std::is_nothrow_destructible<C>::value, ""); } { - typedef std::map<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; static_assert(std::is_nothrow_destructible<C>::value, ""); } { diff --git a/test/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp b/test/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp index 4a35a9227..3bc1e6858 100644 --- a/test/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp +++ b/test/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp @@ -42,7 +42,7 @@ int main() static_assert(!std::is_nothrow_move_assignable<C>::value, ""); } { - typedef std::map<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; static_assert(std::is_nothrow_move_assignable<C>::value, ""); } { diff --git a/test/containers/associative/map/map.cons/move_noexcept.pass.cpp b/test/containers/associative/map/map.cons/move_noexcept.pass.cpp index 18b595fd7..e9ec12029 100644 --- a/test/containers/associative/map/map.cons/move_noexcept.pass.cpp +++ b/test/containers/associative/map/map.cons/move_noexcept.pass.cpp @@ -40,7 +40,7 @@ int main() static_assert(std::is_nothrow_move_constructible<C>::value, ""); } { - typedef std::map<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; static_assert(std::is_nothrow_move_constructible<C>::value, ""); } { diff --git a/test/containers/associative/map/map.special/swap_noexcept.pass.cpp b/test/containers/associative/map/map.special/swap_noexcept.pass.cpp index 5f75032ea..ef2ef0403 100644 --- a/test/containers/associative/map/map.special/swap_noexcept.pass.cpp +++ b/test/containers/associative/map/map.special/swap_noexcept.pass.cpp @@ -47,7 +47,7 @@ int main() static_assert(noexcept(swap(c1, c2)), ""); } { - typedef std::map<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; C c1, c2; static_assert(noexcept(swap(c1, c2)), ""); } diff --git a/test/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp b/test/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp index 56f119a22..a144ba940 100644 --- a/test/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp +++ b/test/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp @@ -42,7 +42,7 @@ int main() static_assert(std::is_nothrow_default_constructible<C>::value, ""); } { - typedef std::multimap<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; static_assert(!std::is_nothrow_default_constructible<C>::value, ""); } { diff --git a/test/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp b/test/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp index f1d8afdc3..14e3f6400 100644 --- a/test/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp +++ b/test/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp @@ -40,7 +40,7 @@ int main() static_assert(std::is_nothrow_destructible<C>::value, ""); } { - typedef std::multimap<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; static_assert(std::is_nothrow_destructible<C>::value, ""); } { diff --git a/test/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp b/test/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp index cada1b1d7..ddb4e484b 100644 --- a/test/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp +++ b/test/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp @@ -42,7 +42,7 @@ int main() static_assert(!std::is_nothrow_move_assignable<C>::value, ""); } { - typedef std::multimap<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; static_assert(std::is_nothrow_move_assignable<C>::value, ""); } { diff --git a/test/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp b/test/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp index 2f0b9ccc8..6ea069949 100644 --- a/test/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp +++ b/test/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp @@ -40,7 +40,7 @@ int main() static_assert(std::is_nothrow_move_constructible<C>::value, ""); } { - typedef std::multimap<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; static_assert(std::is_nothrow_move_constructible<C>::value, ""); } { diff --git a/test/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp b/test/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp index 2aa901a8a..b07d56a21 100644 --- a/test/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp +++ b/test/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp @@ -47,7 +47,7 @@ int main() static_assert(noexcept(swap(c1, c2)), ""); } { - typedef std::multimap<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; C c1, c2; static_assert(noexcept(swap(c1, c2)), ""); } diff --git a/test/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp b/test/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp new file mode 100644 index 000000000..2e3e56ef5 --- /dev/null +++ b/test/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <set> + +// multiset() +// noexcept( +// is_nothrow_default_constructible<allocator_type>::value && +// is_nothrow_default_constructible<key_compare>::value && +// is_nothrow_copy_constructible<key_compare>::value); + +// This tests a conforming extension + +#include <set> +#include <cassert> + +#include "../../../MoveOnly.h" +#include "../../../test_allocator.h" + +template <class T> +struct some_comp +{ + typedef T value_type; + some_comp(); +}; + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::multiset<MoveOnly> C; + static_assert(std::is_nothrow_default_constructible<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_default_constructible<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + static_assert(!std::is_nothrow_default_constructible<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C; + static_assert(!std::is_nothrow_default_constructible<C>::value, ""); + } +#endif +} diff --git a/test/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp b/test/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp new file mode 100644 index 000000000..f04ae9457 --- /dev/null +++ b/test/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <set> + +// ~multiset() // implied noexcept; + +#include <set> +#include <cassert> + +#include "../../../MoveOnly.h" +#include "../../../test_allocator.h" + +#if __has_feature(cxx_noexcept) + +template <class T> +struct some_comp +{ + typedef T value_type; + ~some_comp() noexcept(false); +}; + +#endif + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::multiset<MoveOnly> C; + static_assert(std::is_nothrow_destructible<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_destructible<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_destructible<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C; + static_assert(!std::is_nothrow_destructible<C>::value, ""); + } +#endif +} diff --git a/test/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp b/test/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp new file mode 100644 index 000000000..e5ce34981 --- /dev/null +++ b/test/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <set> + +// multiset& operator=(multiset&& c) +// noexcept( +// allocator_type::propagate_on_container_move_assignment::value && +// is_nothrow_move_assignable<allocator_type>::value && +// is_nothrow_move_assignable<key_compare>::value); + +// This tests a conforming extension + +#include <set> +#include <cassert> + +#include "../../../MoveOnly.h" +#include "../../../test_allocator.h" + +template <class T> +struct some_comp +{ + typedef T value_type; + some_comp& operator=(const some_comp&); +}; + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::multiset<MoveOnly> C; + static_assert(std::is_nothrow_move_assignable<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; + static_assert(!std::is_nothrow_move_assignable<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_move_assignable<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C; + static_assert(!std::is_nothrow_move_assignable<C>::value, ""); + } +#endif +} diff --git a/test/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp b/test/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp new file mode 100644 index 000000000..8f2b49604 --- /dev/null +++ b/test/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <set> + +// multiset(multiset&&) +// noexcept(is_nothrow_move_constructible<allocator_type>::value && +// is_nothrow_move_constructible<key_compare>::value); + +// This tests a conforming extension + +#include <set> +#include <cassert> + +#include "../../../MoveOnly.h" +#include "../../../test_allocator.h" + +template <class T> +struct some_comp +{ + typedef T value_type; + some_comp(const some_comp&); +}; + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::multiset<MoveOnly> C; + static_assert(std::is_nothrow_move_constructible<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_move_constructible<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_move_constructible<C>::value, ""); + } + { + typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C; + static_assert(!std::is_nothrow_move_constructible<C>::value, ""); + } +#endif +} diff --git a/test/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp b/test/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp new file mode 100644 index 000000000..dd2878706 --- /dev/null +++ b/test/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <set> + +// void swap(multiset& c) +// noexcept(!allocator_type::propagate_on_container_swap::value || +// __is_nothrow_swappable<allocator_type>::value); + +// This tests a conforming extension + +#include <set> +#include <cassert> + +#include "../../../MoveOnly.h" +#include "../../../test_allocator.h" + +template <class T> +struct some_comp +{ + typedef T value_type; + + some_comp() {} + some_comp(const some_comp&) {} + void deallocate(void*, unsigned) {} + + typedef std::true_type propagate_on_container_swap; +}; + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::multiset<MoveOnly> C; + C c1, c2; + static_assert(noexcept(swap(c1, c2)), ""); + } + { + typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; + C c1, c2; + static_assert(noexcept(swap(c1, c2)), ""); + } + { + typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + C c1, c2; + static_assert(noexcept(swap(c1, c2)), ""); + } + { + typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C; + C c1, c2; + static_assert(!noexcept(swap(c1, c2)), ""); + } +#endif +} diff --git a/test/containers/associative/set/set.cons/default_noexcept.pass.cpp b/test/containers/associative/set/set.cons/default_noexcept.pass.cpp new file mode 100644 index 000000000..6cf394e64 --- /dev/null +++ b/test/containers/associative/set/set.cons/default_noexcept.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <set> + +// set() +// noexcept( +// is_nothrow_default_constructible<allocator_type>::value && +// is_nothrow_default_constructible<key_compare>::value && +// is_nothrow_copy_constructible<key_compare>::value); + +// This tests a conforming extension + +#include <set> +#include <cassert> + +#include "../../../MoveOnly.h" +#include "../../../test_allocator.h" + +template <class T> +struct some_comp +{ + typedef T value_type; + some_comp(); +}; + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::set<MoveOnly> C; + static_assert(std::is_nothrow_default_constructible<C>::value, ""); + } + { + typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_default_constructible<C>::value, ""); + } + { + typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + static_assert(!std::is_nothrow_default_constructible<C>::value, ""); + } + { + typedef std::set<MoveOnly, some_comp<MoveOnly>> C; + static_assert(!std::is_nothrow_default_constructible<C>::value, ""); + } +#endif +} diff --git a/test/containers/associative/set/set.cons/dtor_noexcept.pass.cpp b/test/containers/associative/set/set.cons/dtor_noexcept.pass.cpp new file mode 100644 index 000000000..66adff0a8 --- /dev/null +++ b/test/containers/associative/set/set.cons/dtor_noexcept.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <set> + +// ~set() // implied noexcept; + +#include <set> +#include <cassert> + +#include "../../../MoveOnly.h" +#include "../../../test_allocator.h" + +#if __has_feature(cxx_noexcept) + +template <class T> +struct some_comp +{ + typedef T value_type; + ~some_comp() noexcept(false); +}; + +#endif + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::set<MoveOnly> C; + static_assert(std::is_nothrow_destructible<C>::value, ""); + } + { + typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_destructible<C>::value, ""); + } + { + typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_destructible<C>::value, ""); + } + { + typedef std::set<MoveOnly, some_comp<MoveOnly>> C; + static_assert(!std::is_nothrow_destructible<C>::value, ""); + } +#endif +} diff --git a/test/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp b/test/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp new file mode 100644 index 000000000..35683b1b6 --- /dev/null +++ b/test/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <set> + +// set& operator=(set&& c) +// noexcept( +// allocator_type::propagate_on_container_move_assignment::value && +// is_nothrow_move_assignable<allocator_type>::value && +// is_nothrow_move_assignable<key_compare>::value); + +// This tests a conforming extension + +#include <set> +#include <cassert> + +#include "../../../MoveOnly.h" +#include "../../../test_allocator.h" + +template <class T> +struct some_comp +{ + typedef T value_type; + some_comp& operator=(const some_comp&); +}; + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::set<MoveOnly> C; + static_assert(std::is_nothrow_move_assignable<C>::value, ""); + } + { + typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; + static_assert(!std::is_nothrow_move_assignable<C>::value, ""); + } + { + typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_move_assignable<C>::value, ""); + } + { + typedef std::set<MoveOnly, some_comp<MoveOnly>> C; + static_assert(!std::is_nothrow_move_assignable<C>::value, ""); + } +#endif +} diff --git a/test/containers/associative/set/set.cons/move_noexcept.pass.cpp b/test/containers/associative/set/set.cons/move_noexcept.pass.cpp new file mode 100644 index 000000000..c3df4cace --- /dev/null +++ b/test/containers/associative/set/set.cons/move_noexcept.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <set> + +// set(set&&) +// noexcept(is_nothrow_move_constructible<allocator_type>::value && +// is_nothrow_move_constructible<key_compare>::value); + +// This tests a conforming extension + +#include <set> +#include <cassert> + +#include "../../../MoveOnly.h" +#include "../../../test_allocator.h" + +template <class T> +struct some_comp +{ + typedef T value_type; + some_comp(const some_comp&); +}; + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::set<MoveOnly> C; + static_assert(std::is_nothrow_move_constructible<C>::value, ""); + } + { + typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_move_constructible<C>::value, ""); + } + { + typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + static_assert(std::is_nothrow_move_constructible<C>::value, ""); + } + { + typedef std::set<MoveOnly, some_comp<MoveOnly>> C; + static_assert(!std::is_nothrow_move_constructible<C>::value, ""); + } +#endif +} diff --git a/test/containers/associative/set/set.special/non_member_swap.pass.cpp b/test/containers/associative/set/set.special/non_member_swap.pass.cpp index 00e19a7db..6f7d0bf5a 100644 --- a/test/containers/associative/set/set.special/non_member_swap.pass.cpp +++ b/test/containers/associative/set/set.special/non_member_swap.pass.cpp @@ -109,7 +109,7 @@ int main() { typedef test_allocator<V> A; typedef test_compare<std::less<int> > C; - typedef std::multiset<int, C, A> M; + typedef std::set<int, C, A> M; V ar1[] = { 1, @@ -143,7 +143,7 @@ int main() { typedef other_allocator<V> A; typedef test_compare<std::less<int> > C; - typedef std::multiset<int, C, A> M; + typedef std::set<int, C, A> M; V ar1[] = { 1, diff --git a/test/containers/associative/set/set.special/swap_noexcept.pass.cpp b/test/containers/associative/set/set.special/swap_noexcept.pass.cpp new file mode 100644 index 000000000..2ce1d8c5e --- /dev/null +++ b/test/containers/associative/set/set.special/swap_noexcept.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <set> + +// void swap(set& c) +// noexcept(!allocator_type::propagate_on_container_swap::value || +// __is_nothrow_swappable<allocator_type>::value); + +// This tests a conforming extension + +#include <set> +#include <cassert> + +#include "../../../MoveOnly.h" +#include "../../../test_allocator.h" + +template <class T> +struct some_comp +{ + typedef T value_type; + + some_comp() {} + some_comp(const some_comp&) {} + void deallocate(void*, unsigned) {} + + typedef std::true_type propagate_on_container_swap; +}; + +int main() +{ +#if __has_feature(cxx_noexcept) + { + typedef std::set<MoveOnly> C; + C c1, c2; + static_assert(noexcept(swap(c1, c2)), ""); + } + { + typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C; + C c1, c2; + static_assert(noexcept(swap(c1, c2)), ""); + } + { + typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C; + C c1, c2; + static_assert(noexcept(swap(c1, c2)), ""); + } + { + typedef std::set<MoveOnly, some_comp<MoveOnly>> C; + C c1, c2; + static_assert(!noexcept(swap(c1, c2)), ""); + } +#endif +} |