mirror of
https://github.com/BlackMATov/flat.hpp.git
synced 2025-12-13 01:36:27 +07:00
make default move/copy ctors and operator=
This commit is contained in:
24
flat_map.hpp
24
flat_map.hpp
@@ -133,27 +133,11 @@ namespace flat_hpp
|
||||
insert(ilist);
|
||||
}
|
||||
|
||||
flat_map(flat_map&& other)
|
||||
: data_(std::move(other.data_))
|
||||
, compare_(std::move(other.compare_)) {}
|
||||
flat_map(flat_map&& other) = default;
|
||||
flat_map(const flat_map& other) = default;
|
||||
|
||||
flat_map(const flat_map& other)
|
||||
: data_(other.data_)
|
||||
, compare_(other.compare_) {}
|
||||
|
||||
flat_map& operator=(flat_map&& other) {
|
||||
if ( this != &other ) {
|
||||
flat_map(std::move(other)).swap(*this);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
flat_map& operator=(const flat_map& other) {
|
||||
if ( this != &other ) {
|
||||
flat_map(other).swap(*this);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
flat_map& operator=(flat_map&& other) = default;
|
||||
flat_map& operator=(const flat_map& other) = default;
|
||||
|
||||
flat_map& operator=(std::initializer_list<value_type> ilist) {
|
||||
flat_map(ilist).swap(*this);
|
||||
|
||||
24
flat_set.hpp
24
flat_set.hpp
@@ -111,27 +111,11 @@ namespace flat_hpp
|
||||
insert(ilist);
|
||||
}
|
||||
|
||||
flat_set(flat_set&& other)
|
||||
: data_(std::move(other.data_))
|
||||
, compare_(std::move(other.compare_)) {}
|
||||
flat_set(flat_set&& other) = default;
|
||||
flat_set(const flat_set& other) = default;
|
||||
|
||||
flat_set(const flat_set& other)
|
||||
: data_(other.data_)
|
||||
, compare_(other.compare_) {}
|
||||
|
||||
flat_set& operator=(flat_set&& other) {
|
||||
if ( this != &other ) {
|
||||
flat_set(std::move(other)).swap(*this);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
flat_set& operator=(const flat_set& other) {
|
||||
if ( this != &other ) {
|
||||
flat_set(other).swap(*this);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
flat_set& operator=(flat_set&& other) = default;
|
||||
flat_set& operator=(const flat_set& other) = default;
|
||||
|
||||
flat_set& operator=(std::initializer_list<value_type> ilist) {
|
||||
flat_set(ilist).swap(*this);
|
||||
|
||||
Reference in New Issue
Block a user