add eraseInto to F14 maps
Summary: It's useful to be able to move the key and value out of a hash table as that entry is being erased. Since std::unordered_map's extract API isn't implementable for hash tables that perform bulk allocation, we expose similar functionality via F14{Fast,Value,Vector,Node}Map::eraseInto. eraseInto gives a key_type&& and mapped_type&& to the specified callback, allowing it to move them elsewhere before the underlying value_type is destroyed. The keen observer will note that there is no way to move the key out of a std::pair<key_type const,mapped_type> without relying on undefined behavior. We already rely on this form of UB to avoid copying keys during rehash, and perform it only when we have total control over the lifecycle of the object and the memory backing the value_type. eraseInto was previously implemented for F14 sets. Reviewed By: shixiao Differential Revision: D19777644 fbshipit-source-id: 9904224af2c6e51abeadae62cc5e66f7bf4b1ae7
Showing
Please register or sign in to comment