llvm-project/libcxx/test/std/containers/associative/map
Eric Fiselier 9bfdb770cc Use multi-key tree search for {map, set}::{count, equal_range}
Patch from ngolovliov@gmail.com
Reviewed as: https://reviews.llvm.org/D42344

As described in llvm.org/PR30959, the current
implementation of std::{map, key}::{count, equal_range} in libcxx is
non-conforming. Quoting the C++14 standard [associative.reqmts]p3

> The phrase “equivalence of keys” means the equivalence relation imposed by
> the comparison and not the operator== on keys. That is, two keys k1 and k2 are
> considered to be equivalent if for the comparison object comp,
> comp(k1, k2) == false && comp(k2, k1) == false.

In the same section, the requirements table states the following:

> a.equal_range(k) equivalent to make_pair(a.lower_bound(k), a.upper_bound(k))
> a.count(k) returns the number of elements with key equivalent to k

The behaviour of libstdc++ seems to conform to the standard here.

llvm-svn: 324799
2018-02-10 02:53:47 +00:00
..
map.access Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065 2017-11-21 21:37:26 +00:00
map.cons Add some tests for operations on const associative containers. Part of LWG#2542 2017-11-22 06:02:27 +00:00
map.modifiers Cleanup _LIBCPP_HAS_NO_<c++11-feature> macros in std::map and std::multimap 2017-04-18 21:08:06 +00:00
map.ops Use multi-key tree search for {map, set}::{count, equal_range} 2018-02-10 02:53:47 +00:00
map.special [libcxx] [test] Fix Clang -Wunused-local-typedef, part 1/3. 2017-02-05 22:47:09 +00:00
PR28469_undefined_behavior_segfault.sh.cpp Update all bug URL's to point to https://bugs.llvm.org/... 2017-02-17 08:37:03 +00:00
allocator_mismatch.fail.cpp Add static_assert to set/multiset/map/multimap/forward_list/deque that the allocator's value_type match the container's value_type. vector/unordered/list/string already do this. Add tests for all the containers to verify this. 2015-11-26 01:24:04 +00:00
compare.pass.cpp Update all bug URL's to point to https://bugs.llvm.org/... 2017-02-17 08:37:03 +00:00
incomplete_type.pass.cpp [libcxx] [test] Fix comment typos, strip trailing whitespace. 2017-01-18 20:10:25 +00:00
types.pass.cpp Replace __cplusplus comparisons and dialect __has_feature checks with TEST_STD_VER. 2016-06-14 21:31:42 +00:00