On Wed, 04 Mar 2026 at 04:07 -0500, Nathan Myers wrote:
Implements P2353R5 "Extending associative containers with the
remaining heterogeneous overloads". Adds overloads templated on
heterogeneous key types for several members of associative
containers, particularly insertions:
I was going to say that it's not necessary (and IMHO actually
unhelpful) to post a [committed] email for a patch that was already
posted+approved.
But then I realised that this *isn't* the same as the patch that was
posted and approved - why is it different?
diff --git a/libstdc++-v3/include/bits/unordered_map.h
b/libstdc++-v3/include/bits/unordered_map.h
index 9b74cba8675..229179933f3 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -839,6 +894,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_h.erase(__position); }
///@}
+ ///@{
/**
* @brief Erases elements according to the provided key.
* @param __x Key of element to be erased.
@@ -861,6 +917,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
erase(_Kt&& __key)
{ return _M_h._M_erase_tr(__key); }
#endif
+ ///@}
/**
* @brief Erases a [__first,__last) range of elements from an
This change was not in the approved [PATCH v12] email. It should be a
harmless change, but it relates to the earlier heterogeneous erasure
work, not this heterogeneous insertion patch. Did it need to be added
to this patch after it had been approved?
@@ -1928,6 +2017,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_h.erase(__position); }
///@}
+ ///@{
/**
* @brief Erases elements according to the provided key.
* @param __x Key of elements to be erased.
@@ -1946,9 +2036,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#ifdef __glibcxx_associative_heterogeneous_erasure // C++23
template <__heterogeneous_hash_key<unordered_multimap> _Kt>
size_type
- erase(_Kt&& __key)
- { return _M_h._M_erase_tr(__key); }
+ erase(_Kt&& __x)
+ { return _M_h._M_erase_tr(__x); }
#endif
+ ///@}
+
/**
* @brief Erases a [__first,__last) range of elements from an
Same here.
diff --git a/libstdc++-v3/include/bits/unordered_set.h
b/libstdc++-v3/include/bits/unordered_set.h
index 22b2ad9caf4..3585fe2c714 100644
--- a/libstdc++-v3/include/bits/unordered_set.h
+++ b/libstdc++-v3/include/bits/unordered_set.h
@@ -761,9 +775,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
template<typename _Kt>
auto
- find(const _Kt& __k)
- -> decltype(_M_h._M_find_tr(__k))
- { return _M_h._M_find_tr(__k); }
+ find(const _Kt& __x)
+ -> decltype(_M_h._M_find_tr(__x))
+ { return _M_h._M_find_tr(__x); }
#endif
const_iterator
@@ -773,9 +787,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
template<typename _Kt>
auto
- find(const _Kt& __k) const
- -> decltype(_M_h._M_find_tr(__k))
- { return _M_h._M_find_tr(__k); }
+ find(const _Kt& __x) const
+ -> decltype(_M_h._M_find_tr(__x))
+ { return _M_h._M_find_tr(__x); }
#endif
///@}
@@ -796,9 +810,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
template<typename _Kt>
auto
- count(const _Kt& __k) const
- -> decltype(_M_h._M_count_tr(__k))
- { return _M_h._M_count_tr(__k); }
+ count(const _Kt& __x) const
+ -> decltype(_M_h._M_count_tr(__x))
+ { return _M_h._M_count_tr(__x); }
#endif
///@}
@@ -815,9 +829,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
- contains(const _Kt& __k) const
- -> decltype(_M_h._M_find_tr(__k), void(), true)
- { return _M_h._M_find_tr(__k) != _M_h.end(); }
+ contains(const _Kt& __x) const
+ -> decltype(_M_h._M_find_tr(__x), void(), true)
+ { return _M_h._M_find_tr(__x) != _M_h.end(); }
///@}
#endif
@@ -837,9 +851,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
template<typename _Kt>
auto
- equal_range(const _Kt& __k)
- -> decltype(_M_h._M_equal_range_tr(__k))
- { return _M_h._M_equal_range_tr(__k); }
+ equal_range(const _Kt& __x)
+ -> decltype(_M_h._M_equal_range_tr(__x))
+ { return _M_h._M_equal_range_tr(__x); }
#endif
std::pair<const_iterator, const_iterator>
@@ -849,9 +863,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
template<typename _Kt>
auto
- equal_range(const _Kt& __k) const
- -> decltype(_M_h._M_equal_range_tr(__k))
- { return _M_h._M_equal_range_tr(__k); }
+ equal_range(const _Kt& __x) const
+ -> decltype(_M_h._M_equal_range_tr(__x))
+ { return _M_h._M_equal_range_tr(__x); }
#endif
///@}
And again here, none of the changes above were in the approved patch,
and aren't part of the insertion feature that the patch implements.
They might be reasonable changes in isolation, but please don't keep
growing the scope of a patch by including unrelated changes in. It
makes the review harder when the patch keeps increasing in scope,
especially when the changes are not logically related.