From f6f28dc41dd13d2117b1ca9ca8f728de429df136 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 19 Nov 2024 23:59:00 +0000 Subject: [PATCH] libstdc++: Use const_iterator in std::set::find return type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit François noticed that the "wrong" type is used in the return type for a std::set member function template. The iterator for our std::set is the same type as const_iterator, so this doesn't actually matter. But it's clearer if the return type matches the type used in the function body. libstdc++-v3/ChangeLog: * include/bits/stl_set.h (set::find): Use const_iterator in return type, not iterator. --- libstdc++-v3/include/bits/stl_set.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index c0eb4dbf65f..3d17626f330 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -875,7 +875,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER template auto upper_bound(const _Kt& __x) const - -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) + -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x))) { return const_iterator(_M_t._M_upper_bound_tr(__x)); } #endif ///@}