Add access to the slot in the lazy constructor. There is a specific use case where I want to cache a pointer to the newly created lazy object. If the capacity of the map does not change between the first and second call of my function, then I use the pointer instead of repeating the lookup. (#219)

Fixed an initialization order issue in ReadWriteLock

Fix the return value of lazy_emplace and lazy_emplace_with_hash.
This commit is contained in:
bpmckinnon
2023-11-29 08:15:02 -06:00
committed by GitHub
parent 9248dcf07e
commit 7556c955d4
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -1506,6 +1506,10 @@ public:
friend class raw_hash_set;
public:
slot_type* slot() const {
return *slot_;
}
template <class... Args>
void operator()(Args&&... args) const {
assert(*slot_);
@@ -3247,7 +3251,7 @@ public:
set.lazy_emplace_at(offset, std::forward<F>(f));
set.set_ctrl(offset, H2(hashval));
}
return iterator_at(offset);
return make_iterator(&inner, set.iterator_at(offset));
}
template <class K = key_type, class F>
+1 -1
View File
@@ -4882,8 +4882,8 @@ public:
private:
mutex_type *m_;
bool locked_shared_;
bool locked_;
bool locked_shared_;
};
// ----------------------------------------------------