Fixes #334 ("Wrong overload resolution protection in implementation of P2363R5") and adds tests with transparent comparator for associative containers.

This commit is contained in:
Ion Gaztañaga
2026-03-22 17:26:15 +01:00
parent 0f99763ea7
commit ce12d2aec5
6 changed files with 88 additions and 33 deletions
+14 -14
View File
@@ -193,7 +193,7 @@ bool constructor_template_auto_deduction_test()
}}}
template<class VoidAllocatorOrContainer>
template<class VoidAllocatorOrContainer, bool Transparent = false>
struct GetMapContainer
{
template<class ValueType>
@@ -202,21 +202,21 @@ struct GetMapContainer
typedef std::pair<ValueType, ValueType> type_t;
typedef flat_map< ValueType
, ValueType
, std::less<ValueType>
, typename dtl::if_c<Transparent, test::less_transparent, std::less<ValueType> >::type
, typename boost::container::dtl::container_or_allocator_rebind<VoidAllocatorOrContainer, type_t>::type
> map_type;
typedef flat_multimap< ValueType
, ValueType
, std::less<ValueType>
, typename dtl::if_c<Transparent, test::less_transparent, std::less<ValueType> >::type
, typename boost::container::dtl::container_or_allocator_rebind<VoidAllocatorOrContainer, type_t>::type
> multimap_type;
};
};
//To test default parameters
template<>
struct GetMapContainer<void>
template<bool Transparent>
struct GetMapContainer<void, Transparent>
{
template<class ValueType>
struct apply
@@ -389,15 +389,6 @@ int main()
return 1;
}
if (0 != test::flat_map_test
< GetMapContainer<void>::apply<int>::map_type
, MyStdMap
, GetMapContainer<void>::apply<int>::multimap_type
, MyStdMultiMap>()) {
std::cout << "Error in flat_map_test<new_allocator<void> >" << std::endl;
return 1;
}
if (0 != test::flat_map_test
< GetMapContainer<new_allocator<void> >::apply<int>::map_type
, MyStdMap
@@ -433,6 +424,15 @@ int main()
std::cout << "Error in flat_map_test<new_allocator<void> >" << std::endl;
return 1;
}
if (0 != test::flat_map_test
< GetMapContainer<new_allocator<void>, true>::apply<test::movable_and_copyable_int>::map_type
, MyStdMap
, GetMapContainer<new_allocator<void>, true>::apply<test::movable_and_copyable_int>::multimap_type
, MyStdMultiMap>()) {
std::cout << "Error in flat_map_test<new_allocator<void>, transparent >" << std::endl;
return 1;
}
}
if(!boost::container::test::test_map_support_for_initialization_list_for<flat_map<int, int> >())