noexcept for <set>. Plus a few fixes to noexcept for <map>.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132640 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2011-06-04 15:22:34 +00:00
parent 7686add61e
commit b2e2a8f6f3
23 changed files with 723 additions and 128 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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, "");
}
{

View File

@ -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, "");
}
{

View File

@ -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, "");
}
{

View File

@ -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, "");
}
{

View File

@ -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)), "");
}

View File

@ -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, "");
}
{

View File

@ -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, "");
}
{

View File

@ -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, "");
}
{

View File

@ -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, "");
}
{

View File

@ -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)), "");
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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,

View File

@ -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
}