30template<
typename Src1,
typename Src2,
typename Dst1,
typename Dst2>
33 new ((
void *)dst1) Dst1(std::forward<Src1>(src1));
35 new ((
void *)dst2) Dst2(std::forward<Src2>(src2));
50 enum State : uint8_t {
74 if (state_ == Occupied) {
75 key_buffer_.ref().~Key();
76 value_buffer_.ref().~Value();
86 state_ = other.state_;
87 if (other.state_ == Occupied) {
89 other.value_buffer_.
ref(),
101 std::is_nothrow_move_constructible_v<Value>)
103 state_ = other.state_;
104 if (other.state_ == Occupied) {
106 std::move(other.value_buffer_.ref()),
108 value_buffer_.ptr());
133 return value_buffer_;
141 return value_buffer_;
149 return state_ == Occupied;
157 return state_ == Empty;
167 return hash(*key_buffer_);
174 template<
typename ForwardKey,
typename IsEqual>
177 if (state_ == Occupied) {
178 return is_equal(
key, *key_buffer_);
187 template<
typename ForwardKey,
typename... ForwardValue>
191 new (&value_buffer_) Value(std::forward<ForwardValue>(
value)...);
204 new (&key_buffer_)
Key(std::forward<ForwardKey>(
key));
208 value_buffer_.ref().~Value();
221 key_buffer_.
ref().~Key();
222 value_buffer_.ref().~Value();
237 Key key_ = KeyInfo::get_empty();
245 if (KeyInfo::is_not_empty_or_removed(key_)) {
246 value_buffer_.ref().~Value();
252 if (KeyInfo::is_not_empty_or_removed(key_)) {
253 new (&value_buffer_) Value(*other.value_buffer_);
259 if (KeyInfo::is_not_empty_or_removed(key_)) {
260 new (&value_buffer_) Value(std::move(*other.value_buffer_));
276 return value_buffer_;
281 return value_buffer_;
286 return KeyInfo::is_not_empty_or_removed(key_);
291 return KeyInfo::is_empty(key_);
300 template<
typename ForwardKey,
typename IsEqual>
304 return is_equal(
key, key_);
307 template<
typename ForwardKey,
typename... ForwardValue>
312 new (&value_buffer_) Value(std::forward<ForwardValue>(
value)...);
321 key_ = std::forward<ForwardKey>(
key);
324 value_buffer_.ref().~Value();
332 value_buffer_.
ref().~Value();
333 KeyInfo::remove(key_);
337template<
typename Key,
typename Value>
struct DefaultMapSlot;
unsigned long long int uint64_t
void occupy_no_value(ForwardKey &&key, uint64_t)
const Value * value() const
IntrusiveMapSlot(IntrusiveMapSlot &&other) noexcept
bool contains(const ForwardKey &key, const IsEqual &is_equal, uint64_t) const
IntrusiveMapSlot(const IntrusiveMapSlot &other)
void occupy(ForwardKey &&key, uint64_t hash, ForwardValue &&...value)
uint64_t get_hash(const Hash &hash)
IntrusiveMapSlot()=default
SimpleMapSlot(const SimpleMapSlot &other)
SimpleMapSlot(SimpleMapSlot &&other) noexcept(std::is_nothrow_move_constructible_v< Key > &&std::is_nothrow_move_constructible_v< Value >)
const Value * value() const
uint64_t get_hash(const Hash &hash)
bool contains(const ForwardKey &key, const IsEqual &is_equal, uint64_t) const
void occupy(ForwardKey &&key, uint64_t hash, ForwardValue &&...value)
void occupy_no_value(ForwardKey &&key, uint64_t)
void initialize_pointer_pair(Src1 &&src1, Src2 &&src2, Dst1 *dst1, Dst2 *dst2)
IntrusiveMapSlot< Key *, Value, PointerKeyInfo< Key * > > type
SimpleMapSlot< Key, Value > type