callWithExtractedKey fix for pair of lvalue ref, improvements
Summary: callWithExtractedKey previously incorrectly translated std::pair<X&,Y&>&& into X&&, Y&&, when reference collapsing rules call instead for X& and Y&. This diff fixes the problem, adds unit tests, and also targets the 2-argument std::pair constructor when possible. This means that callWithExtractedKey can be safely used on top of libc++'s std::unordered_map::emplace without disabling the key-finding optimization in that method. (That lib's emplace is clever enough to be able to search on the key before constructing a node, but does not include the logic to unwrap the std::pair 3-arg piecewise constructor.) Reviewed By: yfeldblum Differential Revision: D21419822 fbshipit-source-id: d3c61e45d7fe7d8c6805342bbe63a8c866f4e306
Showing
Please register or sign in to comment