Minor improvements.
This commit is contained in:
parent
206becbb9f
commit
d55869eedb
@ -469,7 +469,8 @@ class FlatHashTableChunks {
|
||||
struct ChunkIt {
|
||||
size_t chunk_i;
|
||||
size_t chunk_mask;
|
||||
size_t shift{};
|
||||
size_t shift;
|
||||
|
||||
size_t pos() const {
|
||||
return chunk_i;
|
||||
}
|
||||
@ -482,7 +483,7 @@ class FlatHashTableChunks {
|
||||
};
|
||||
|
||||
ChunkIt get_chunk_it(size_t chunk_i) {
|
||||
return {chunk_i, chunks_.size() - 1};
|
||||
return ChunkIt{chunk_i, chunks_.size() - 1, 0};
|
||||
}
|
||||
|
||||
HashInfo calc_hash(const KeyT &key) {
|
||||
|
@ -54,7 +54,7 @@ struct MapNode {
|
||||
DCHECK(empty());
|
||||
DCHECK(!other.empty());
|
||||
first = std::move(other.first);
|
||||
other.first = KeyT{};
|
||||
other.first = KeyT();
|
||||
new (&second) ValueT(std::move(other.second));
|
||||
other.second.~ValueT();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ struct SetNode {
|
||||
using public_type = const KeyT;
|
||||
using second_type = KeyT; // TODO: remove second_type?
|
||||
|
||||
KeyT first{};
|
||||
KeyT first;
|
||||
|
||||
const KeyT &key() const {
|
||||
return first;
|
||||
@ -30,7 +30,8 @@ struct SetNode {
|
||||
return first;
|
||||
}
|
||||
|
||||
SetNode() = default;
|
||||
SetNode(): first() {
|
||||
}
|
||||
explicit SetNode(KeyT key) : first(std::move(key)) {
|
||||
}
|
||||
SetNode(const SetNode &other) = delete;
|
||||
@ -42,7 +43,7 @@ struct SetNode {
|
||||
DCHECK(empty());
|
||||
DCHECK(!other.empty());
|
||||
first = std::move(other.first);
|
||||
other.first = KeyT{};
|
||||
other.first = KeyT();
|
||||
}
|
||||
~SetNode() = default;
|
||||
|
||||
@ -71,7 +72,7 @@ struct SetNode<KeyT, typename std::enable_if_t<(sizeof(KeyT) > 28 * sizeof(void
|
||||
struct Impl {
|
||||
using second_type = KeyT;
|
||||
|
||||
KeyT first{};
|
||||
KeyT first;
|
||||
|
||||
template <class InputKeyT>
|
||||
explicit Impl(InputKeyT &&key) : first(std::forward<InputKeyT>(key)) {
|
||||
@ -99,7 +100,7 @@ struct SetNode<KeyT, typename std::enable_if_t<(sizeof(KeyT) > 28 * sizeof(void
|
||||
return impl_->first;
|
||||
}
|
||||
|
||||
SetNode() {
|
||||
SetNode(): impl_() {
|
||||
}
|
||||
explicit SetNode(KeyT key) : impl_(td::make_unique<Impl>(std::move(key))) {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user