Remove unneeded return values from hashtable move-assignment operators.
This commit is contained in:
parent
1f12b0d8e8
commit
5f5205ae6c
|
@ -9,10 +9,12 @@
|
|||
#include "td/utils/FlatHashMapChunks.h"
|
||||
#include "td/utils/FlatHashMapLinear.h"
|
||||
|
||||
#include <functional>
|
||||
//#include <unordered_map>
|
||||
//#include <unordered_set>
|
||||
|
||||
namespace td {
|
||||
|
||||
template <class KeyT, class ValueT, class HashT = std::hash<KeyT>, class EqT = std::equal_to<KeyT>>
|
||||
using FlatHashMap = FlatHashMapImpl<KeyT, ValueT, HashT, EqT>;
|
||||
//using FlatHashMap = FlatHashMapChunks<KeyT, ValueT, HashT, EqT>;
|
||||
|
|
|
@ -55,14 +55,13 @@ struct MapNode {
|
|||
MapNode(MapNode &&other) noexcept {
|
||||
*this = std::move(other);
|
||||
}
|
||||
MapNode &operator=(MapNode &&other) noexcept {
|
||||
void operator=(MapNode &&other) noexcept {
|
||||
DCHECK(empty());
|
||||
DCHECK(!other.empty());
|
||||
first = std::move(other.first);
|
||||
other.first = KeyT{};
|
||||
new (&second) ValueT(std::move(other.second));
|
||||
other.second.~ValueT();
|
||||
return *this;
|
||||
}
|
||||
~MapNode() {
|
||||
if (!empty()) {
|
||||
|
@ -120,12 +119,11 @@ struct SetNode {
|
|||
SetNode(SetNode &&other) noexcept {
|
||||
*this = std::move(other);
|
||||
}
|
||||
SetNode &operator=(SetNode &&other) noexcept {
|
||||
void operator=(SetNode &&other) noexcept {
|
||||
DCHECK(empty());
|
||||
DCHECK(!other.empty());
|
||||
first = std::move(other.first);
|
||||
other.first = KeyT{};
|
||||
return *this;
|
||||
}
|
||||
~SetNode() = default;
|
||||
|
||||
|
@ -248,10 +246,9 @@ class FlatHashTable {
|
|||
FlatHashTable(const FlatHashTable &other) {
|
||||
assign(other);
|
||||
}
|
||||
FlatHashTable &operator=(const FlatHashTable &other) {
|
||||
void operator=(const FlatHashTable &other) {
|
||||
clear();
|
||||
assign(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
FlatHashTable(std::initializer_list<Node> nodes) {
|
||||
|
@ -280,11 +277,10 @@ class FlatHashTable {
|
|||
FlatHashTable(FlatHashTable &&other) noexcept : nodes_(std::move(other.nodes_)), used_nodes_(other.used_nodes_) {
|
||||
other.used_nodes_ = 0;
|
||||
}
|
||||
FlatHashTable &operator=(FlatHashTable &&other) noexcept {
|
||||
void operator=(FlatHashTable &&other) noexcept {
|
||||
nodes_ = std::move(other.nodes_);
|
||||
used_nodes_ = other.used_nodes_;
|
||||
other.used_nodes_ = 0;
|
||||
return *this;
|
||||
}
|
||||
void swap(FlatHashTable &other) noexcept {
|
||||
nodes_.swap(other.nodes_);
|
||||
|
|
Loading…
Reference in New Issue
Block a user