Let map-related functions be templated over key types
authorYedidya Feldblum <yfeldblum@fb.com>
Mon, 5 Jun 2017 21:35:46 +0000 (14:35 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 5 Jun 2017 21:50:32 +0000 (14:50 -0700)
commit5480083584caaf6942ce289e1a66d32219b854b9
tree05dbf74a8a6e8e37ee6afef1d3db9ebc5371e055
parenta6b10d84b12734b6cde0d94530b1e3e4635ce00a
Let map-related functions be templated over key types

Summary:
[Folly] Let map-related functions be templated over key types.

This supports the case where map members like `find` may be overloaded or templated on types other than the map's `key_type const&`.

In C++14, standard library map types gain template overloads for `find` and for other members, permitting lookups without constructing `key_type` instances. This is useful primarily when `key_type` is expensive but another object type comparable with `key_type` is inexpensive. As a common example, a `key_type` of `std::string` is expensive in the general case because it allocates storage on the heap but `std::string_view` (C++17), when constructed with non-allocated `char const*, std::size_t`, would be inexpensive.

Reviewed By: terrelln

Differential Revision: D5145879

fbshipit-source-id: 979b75bfe55661aab11d5302da1bcd7830abd5af
folly/MapUtil.h