diff --git a/stl/inc/flat_map b/stl/inc/flat_map index 1e6eac4961b..2fd94bba83b 100644 --- a/stl/inc/flat_map +++ b/stl/inc/flat_map @@ -33,30 +33,6 @@ _STL_DISABLE_CLANG_WARNINGS #undef msvc _STD_BEGIN -template -struct _Flat_map_value_compare_provider { - struct value_compare { - public: - _NODISCARD bool operator()( - pair _Left, pair _Right) const { - return _Key_comparator(_Left.first, _Right.first); - } - - value_compare(_KeyCompare _Comp) : _Key_comparator(_Comp) {} - - private: - _KeyCompare _Key_comparator; - }; -}; - -template -struct _Flat_map_container_provider { - struct containers { - _KeyContainer keys; - _MappedContainer values; - }; -}; - // Implementation template @@ -342,8 +318,22 @@ public: "mapped_container_type must support random-access iterators in order to be adapted. " "(N5014 [flat.map.overview]/7, [flat.multimap.overview]/7)"); - using value_compare = _Flat_map_value_compare_provider::value_compare; - using containers = _Flat_map_container_provider::containers; + struct value_compare { + public: + _NODISCARD bool operator()(const_reference _Left, const_reference _Right) const { + return _Key_comparator(_Left.first, _Right.first); + } + + value_compare(key_compare _Comp) : _Key_comparator(_Comp) {} + + private: + key_compare _Key_comparator; + }; + + struct containers { + key_container_type keys; + mapped_container_type values; + }; public: // [flat.map.cons] Constructors diff --git a/tests/std/tests/P0429R9_flat_map/test.cpp b/tests/std/tests/P0429R9_flat_map/test.cpp index 74e88ddc81d..38aad5ca5ec 100644 --- a/tests/std/tests/P0429R9_flat_map/test.cpp +++ b/tests/std/tests/P0429R9_flat_map/test.cpp @@ -16,6 +16,11 @@ using namespace std; +// See GH-5965: Speculative resolution of LWG-3963 "Different flat_(multi)map specializations +// should be able to share same nested classes" is not likely to be accepted +static_assert(!is_same_v::containers, flat_multimap::containers>); +static_assert(!is_same_v::value_compare, flat_multimap::value_compare>); + template class Tmpl> constexpr bool is_specialization_v = false; template