add swap noexcept

This commit is contained in:
2019-05-12 17:12:45 +07:00
parent 574de9c995
commit 05934cac38
8 changed files with 118 additions and 142 deletions

View File

@@ -319,7 +319,10 @@ namespace flat_hpp
: 0;
}
void swap(flat_map& other) {
void swap(flat_map& other)
noexcept(std::is_nothrow_swappable_v<base_type>
&& std::is_nothrow_swappable_v<container_type>)
{
using std::swap;
swap(
static_cast<base_type&>(*this),
@@ -397,6 +400,7 @@ namespace flat_hpp
void swap(
flat_map<Key, Value, Compare, Container>& l,
flat_map<Key, Value, Compare, Container>& r)
noexcept(noexcept(l.swap(r)))
{
l.swap(r);
}

View File

@@ -315,7 +315,10 @@ namespace flat_hpp
return r;
}
void swap(flat_multimap& other) {
void swap(flat_multimap& other)
noexcept(std::is_nothrow_swappable_v<base_type>
&& std::is_nothrow_swappable_v<container_type>)
{
using std::swap;
swap(
static_cast<base_type&>(*this),
@@ -393,6 +396,7 @@ namespace flat_hpp
void swap(
flat_multimap<Key, Value, Compare, Container>& l,
flat_multimap<Key, Value, Compare, Container>& r)
noexcept(noexcept(l.swap(r)))
{
l.swap(r);
}

View File

@@ -230,7 +230,10 @@ namespace flat_hpp
return r;
}
void swap(flat_multiset& other) {
void swap(flat_multiset& other)
noexcept(std::is_nothrow_swappable_v<base_type>
&& std::is_nothrow_swappable_v<container_type>)
{
using std::swap;
swap(
static_cast<base_type&>(*this),
@@ -301,6 +304,7 @@ namespace flat_hpp
void swap(
flat_multiset<Key, Compare, Container>& l,
flat_multiset<Key, Compare, Container>& r)
noexcept(noexcept(l.swap(r)))
{
l.swap(r);
}

View File

@@ -234,7 +234,10 @@ namespace flat_hpp
: 0;
}
void swap(flat_set& other) {
void swap(flat_set& other)
noexcept(std::is_nothrow_swappable_v<base_type>
&& std::is_nothrow_swappable_v<container_type>)
{
using std::swap;
swap(
static_cast<base_type&>(*this),
@@ -305,6 +308,7 @@ namespace flat_hpp
void swap(
flat_set<Key, Compare, Container>& l,
flat_set<Key, Compare, Container>& r)
noexcept(noexcept(l.swap(r)))
{
l.swap(r);
}