Heterogeneous lookups for sorted_vector types
authorYedidya Feldblum <yfeldblum@fb.com>
Wed, 8 Nov 2017 17:22:17 +0000 (09:22 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 8 Nov 2017 17:49:39 +0000 (09:49 -0800)
commitd03823c895ec509247b2125fcc4ac43628b16fea
treeed5dd9485b8f70a7fceab84ea47a3499cb3cfa50
parent85ad5f4602530471df315db6d981678874bcd32e
Heterogeneous lookups for sorted_vector types

Summary:
[Folly] Heterogeneous lookups for `sorted_vector` types.

When the `Compare` type has member type or alias `is_transparent`, enable template overloads of `count`, `find`, `lower_bound`, `upper_bound`, and `equal_range` on both `sorted_vector_set` and `sorted_vector_map`.

This is the protocol found in the equivalent `std::set` and `std::map` member functions.

> This overload only participates in overload resolution if the qualified-id `Compare::is_transparent` is valid and denotes a type. They allow calling this function without constructing an instance of `Key`.
>
> http://en.cppreference.com/w/cpp/container/set/count (same wording in all 10 cases)

Reviewed By: nbronson

Differential Revision: D6256989

fbshipit-source-id: a40a181453a019564e8f7674e1e07e241d5ab068
folly/sorted_vector_types.h
folly/test/sorted_vector_test.cpp