r/cpp • • Aug 13 '26

C++26: std::indirect

https://www.sandordargo.com/blog/2026/08/12/cpp26-indirect
164 Upvotes

157 comments sorted by

View all comments

5

u/SirClueless Aug 14 '26

Very useful now that the state of the art for hash maps is open-addressing tables without reference stability and poor performance if your object is large and expensive to move.

absl::flat_hash_map<std::indirect<BigExpensiveStruct>, int>

Presumably will just work, no custom comparators and hash implementations for std::unique_ptr required.