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 {
21432143 return *slot_;
21442144 }
21452145
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.
21472149 template <class ... Args>
2148- slot_type* operator ()(Args&&... args) const {
2150+ const auto & operator ()(Args&&... args) const {
21492151 assert (*slot_);
21502152 PolicyTraits::construct (alloc_, *slot_, std::forward<Args>(args)...);
2151- return *slot_ ;
2153+ return PolicyTraits::element ( slot ()) ;
21522154 }
21532155
21542156 private:
You can’t perform that action at this time.
0 commit comments