Skip to content

Commit 1c8a6e4

Browse files
committed
Update constructor so that the call operator returns a pointer to the slot.
1 parent a9153b7 commit 1c8a6e4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/gtl/phmap.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,11 +2143,12 @@ class raw_hash_set {
21432143
return *slot_;
21442144
}
21452145

2146+
// returns a pointer to the inserted value
21462147
template<class... Args>
2147-
void operator()(Args&&... args) const {
2148+
slot_type* operator()(Args&&... args) const {
21482149
assert(*slot_);
21492150
PolicyTraits::construct(alloc_, *slot_, std::forward<Args>(args)...);
2150-
*slot_ = nullptr;
2151+
return *slot_;
21512152
}
21522153

21532154
private:
@@ -2204,7 +2205,6 @@ class raw_hash_set {
22042205
void lazy_emplace_at(size_t& idx, F&& f) {
22052206
slot_type* slot = slots_ + idx;
22062207
std::forward<F>(f)(constructor(&alloc_ref(), &slot));
2207-
assert(!slot);
22082208
}
22092209

22102210
template<class K = key_type, class F>

0 commit comments

Comments
 (0)