* Implemented C++20 contains() for associative containers as specified in P0458R2.

* Fixed serious bug in heterogeneous lookup functions (is_transparent was broken).
This commit is contained in:
Ion Gaztañaga
2018-08-13 15:36:00 +02:00
parent 1ad64316a4
commit 139db663a3
16 changed files with 220 additions and 16 deletions
+12 -1
View File
@@ -454,6 +454,8 @@ struct get_real_stored_allocator<flat_multimap<Key, T, Compare, Allocator> >
bool test_heterogeneous_lookups()
{
BOOST_STATIC_ASSERT((dtl::is_transparent<less_transparent>::value));
BOOST_STATIC_ASSERT(!(dtl::is_transparent<std::less<int> >::value));
typedef flat_map<int, char, less_transparent> map_t;
typedef flat_multimap<int, char, less_transparent> mmap_t;
typedef map_t::value_type value_type;
@@ -498,6 +500,16 @@ bool test_heterogeneous_lookups()
if(cmmap1.count(find_me) != 2)
return false;
//contains
if(!map1.contains(find_me))
return false;
if(!cmap1.contains(find_me))
return false;
if(!mmap1.contains(find_me))
return false;
if(!cmmap1.contains(find_me))
return false;
//lower_bound
if(map1.lower_bound(find_me)->second != 'd')
return false;
@@ -709,4 +721,3 @@ int main()
}
#include <boost/container/detail/config_end.hpp>