File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -2143,12 +2143,14 @@ class raw_hash_set {
2143
2143
return *slot_;
2144
2144
}
2145
2145
2146
- // returns a pointer to the inserted value
2146
+ // returns a reference to the inserted `value_type`.
2147
+ // beware that the returned reference is stable only for `node` hash map or sets. When using
2148
+ // a `flat` version, this reference can be used immediately, but we shouldn't store a pointer to it.
2147
2149
template <class ... Args>
2148
- slot_type* operator ()(Args&&... args) const {
2150
+ const auto & operator ()(Args&&... args) const {
2149
2151
assert (*slot_);
2150
2152
PolicyTraits::construct (alloc_, *slot_, std::forward<Args>(args)...);
2151
- return *slot_ ;
2153
+ return PolicyTraits::element ( slot ()) ;
2152
2154
}
2153
2155
2154
2156
private:
You can’t perform that action at this time.
0 commit comments