<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gcc.git/libstdc++-v3/include/std/flat_map, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/'/>
<entry>
<title>libstdc++: Fix flat_map::operator[] for const lvalue keys [PR120432]</title>
<updated>2025-06-06T13:34:17+00:00</updated>
<author>
<name>Patrick Palka</name>
<email>ppalka@redhat.com</email>
</author>
<published>2025-06-06T13:34:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=91ed3248ce26aaaee4d7471aa4edbc07b3f1a90e'/>
<id>91ed3248ce26aaaee4d7471aa4edbc07b3f1a90e</id>
<content type='text'>
The const lvalue operator[] overload wasn't properly forwarding the key
type to the generic overload, causing a hard error for const keys.

Rather than correcting the forwarded type this patch just makes the
non-template overloads call try_emplace directly instead.  That way we
can remove the non-standard same_as constraint on the generic overload
and match the spec more closely.

	PR libstdc++/120432

libstdc++-v3/ChangeLog:

	* include/std/flat_map (flat_map::operator[]): Make the
	non-template overloads call try_emplace directly.  Remove
	non-standard same_as constraint on the template overload.
	* testsuite/23_containers/flat_map/1.cc (test08): New test.

Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The const lvalue operator[] overload wasn't properly forwarding the key
type to the generic overload, causing a hard error for const keys.

Rather than correcting the forwarded type this patch just makes the
non-template overloads call try_emplace directly instead.  That way we
can remove the non-standard same_as constraint on the generic overload
and match the spec more closely.

	PR libstdc++/120432

libstdc++-v3/ChangeLog:

	* include/std/flat_map (flat_map::operator[]): Make the
	non-template overloads call try_emplace directly.  Remove
	non-standard same_as constraint on the template overload.
	* testsuite/23_containers/flat_map/1.cc (test08): New test.

Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Compare keys and values separately in flat_map::operator==</title>
<updated>2025-05-29T14:12:23+00:00</updated>
<author>
<name>Patrick Palka</name>
<email>ppalka@redhat.com</email>
</author>
<published>2025-05-29T14:12:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=ad96f0344adfc847874b34b43f30371979ae9963'/>
<id>ad96f0344adfc847874b34b43f30371979ae9963</id>
<content type='text'>
Instead of effectively doing a zipped comparison of the keys and values,
compare them separately to leverage the underlying containers' optimized
equality implementations.

libstdc++-v3/ChangeLog:

	* include/std/flat_map (_Flat_map_impl::operator==): Compare
	keys and values separately.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of effectively doing a zipped comparison of the keys and values,
compare them separately to leverage the underlying containers' optimized
equality implementations.

libstdc++-v3/ChangeLog:

	* include/std/flat_map (_Flat_map_impl::operator==): Compare
	keys and values separately.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Fix tuple/pair confusion with std::erase_if(flat_map) [PR120465]</title>
<updated>2025-05-29T14:11:57+00:00</updated>
<author>
<name>Patrick Palka</name>
<email>ppalka@redhat.com</email>
</author>
<published>2025-05-29T14:11:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=589b27ec5769410e036df57645ff1eb7c765f692'/>
<id>589b27ec5769410e036df57645ff1eb7c765f692</id>
<content type='text'>
std::erase_if for flat_map/multimap is implemented via ranges::erase_if
over a zip_view of the keys and values, the value_type of which is a
tuple, but the given predicate needs to be called with a pair (flat_map's
value_type).  So use a projection to convert the tuple into a suitable
pair.

	PR libstdc++/120465

libstdc++-v3/ChangeLog:

	* include/std/flat_map (_Flat_map_impl::_M_erase_if): Use a
	projection with ranges::remove_if to pass a pair instead of
	a tuple to the predicate.
	* testsuite/23_containers/flat_map/1.cc (test07): Strengthen
	to expect the argument passed to the predicate is a pair.
	* testsuite/23_containers/flat_multimap/1.cc (test07): Likewise.

Co-authored-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
std::erase_if for flat_map/multimap is implemented via ranges::erase_if
over a zip_view of the keys and values, the value_type of which is a
tuple, but the given predicate needs to be called with a pair (flat_map's
value_type).  So use a projection to convert the tuple into a suitable
pair.

	PR libstdc++/120465

libstdc++-v3/ChangeLog:

	* include/std/flat_map (_Flat_map_impl::_M_erase_if): Use a
	projection with ranges::remove_if to pass a pair instead of
	a tuple to the predicate.
	* testsuite/23_containers/flat_map/1.cc (test07): Strengthen
	to expect the argument passed to the predicate is a pair.
	* testsuite/23_containers/flat_multimap/1.cc (test07): Likewise.

Co-authored-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Fix availability of std::erase_if(std::flat_foo) [PR119427]</title>
<updated>2025-04-29T12:21:35+00:00</updated>
<author>
<name>Patrick Palka</name>
<email>ppalka@redhat.com</email>
</author>
<published>2025-04-29T12:21:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=aa93272cfd2233858da0792761387cc27f4d5ff3'/>
<id>aa93272cfd2233858da0792761387cc27f4d5ff3</id>
<content type='text'>
These std::erase_if overloads were wrongly implemented as hidden
friends, visible only via ADL, so erase_if(x) would work but not
std::erase_if(x).

	PR libstdc++/119427

libstdc++-v3/ChangeLog:

	* include/std/flat_map (_Flat_map_impl::erase_if): Replace
	this hidden friend with ...
	(_Flat_map_impl::_M_erase_if): ... this member function.
	(flat_map): Export _Flat_map_impl::_M_erase_if.
	(erase_if(flat_map)): Define.
	(flat_multimap): Export _Flat_map_impl::_M_erase_if.
	(erase_if(flat_multimap)): Define.
	* include/std/flat_set (_Flat_set_impl::erase_if): Replace
	with ...
	(_Flat_set_impl::_M_erase_if): ... this member function.
	(flat_set): Export _Flat_set_impl::_M_erase_if.
	(erase_if(flat_set)): Define.
	(flat_multiset): Export _Flat_set_impl::_M_erase_if.
	(erase_if(flat_multiset)): Define.
	* testsuite/23_containers/flat_map/1.cc (test07): New test.
	* testsuite/23_containers/flat_multimap/1.cc (test07): New test.
	* testsuite/23_containers/flat_multiset/1.cc (test09): New test.
	* testsuite/23_containers/flat_set/1.cc (test09): New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These std::erase_if overloads were wrongly implemented as hidden
friends, visible only via ADL, so erase_if(x) would work but not
std::erase_if(x).

	PR libstdc++/119427

libstdc++-v3/ChangeLog:

	* include/std/flat_map (_Flat_map_impl::erase_if): Replace
	this hidden friend with ...
	(_Flat_map_impl::_M_erase_if): ... this member function.
	(flat_map): Export _Flat_map_impl::_M_erase_if.
	(erase_if(flat_map)): Define.
	(flat_multimap): Export _Flat_map_impl::_M_erase_if.
	(erase_if(flat_multimap)): Define.
	* include/std/flat_set (_Flat_set_impl::erase_if): Replace
	with ...
	(_Flat_set_impl::_M_erase_if): ... this member function.
	(flat_set): Export _Flat_set_impl::_M_erase_if.
	(erase_if(flat_set)): Define.
	(flat_multiset): Export _Flat_set_impl::_M_erase_if.
	(erase_if(flat_multiset)): Define.
	* testsuite/23_containers/flat_map/1.cc (test07): New test.
	* testsuite/23_containers/flat_multimap/1.cc (test07): New test.
	* testsuite/23_containers/flat_multiset/1.cc (test09): New test.
	* testsuite/23_containers/flat_set/1.cc (test09): New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Fix flat_foo::insert_range for non-common ranges [PR118156]</title>
<updated>2025-01-31T20:53:12+00:00</updated>
<author>
<name>Patrick Palka</name>
<email>ppalka@redhat.com</email>
</author>
<published>2025-01-31T20:53:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=a9172b107a24b244e0b71c2575dd6448d48b3ae3'/>
<id>a9172b107a24b244e0b71c2575dd6448d48b3ae3</id>
<content type='text'>
This fixes flat_map/multimap::insert_range by just generalizing the
insert implementation to handle heterogenous iterator/sentinel pair.
I'm not sure we can do better than this, e.g. we can't implement it in
terms of the adapted containers' insert_range because that'd require two
passes over the range.

For flat_set/multiset, we can implement insert_range directly in terms
of the adapted container's insert_range.  A fallback implementation
is also provided if insert_range isn't available, as is the case for
std::deque currently.

	PR libstdc++/118156

libstdc++-v3/ChangeLog:

	* include/std/flat_map (_Flat_map_impl::_M_insert): Generalized
	version of insert taking heterogenous iterator/sentinel pair.
	(_Flat_map_impl::insert): Dispatch to _M_insert.
	(_Flat_map_impl::insert_range): Likewise.
	(flat_map): Export _Flat_map_impl::insert_range.
	(flat_multimap): Likewise.
	* include/std/flat_set (_Flat_set_impl::insert_range):
	Reimplement directly, not in terms of insert.
	(flat_set): Export _Flat_set_impl::insert_range.
	(flat_multiset): Likewise.
	* testsuite/23_containers/flat_map/1.cc (test06): New test.
	* testsuite/23_containers/flat_multimap/1.cc (test06): New test.
	* testsuite/23_containers/flat_multiset/1.cc (test06): New test.
	* testsuite/23_containers/flat_set/1.cc (test06): New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes flat_map/multimap::insert_range by just generalizing the
insert implementation to handle heterogenous iterator/sentinel pair.
I'm not sure we can do better than this, e.g. we can't implement it in
terms of the adapted containers' insert_range because that'd require two
passes over the range.

For flat_set/multiset, we can implement insert_range directly in terms
of the adapted container's insert_range.  A fallback implementation
is also provided if insert_range isn't available, as is the case for
std::deque currently.

	PR libstdc++/118156

libstdc++-v3/ChangeLog:

	* include/std/flat_map (_Flat_map_impl::_M_insert): Generalized
	version of insert taking heterogenous iterator/sentinel pair.
	(_Flat_map_impl::insert): Dispatch to _M_insert.
	(_Flat_map_impl::insert_range): Likewise.
	(flat_map): Export _Flat_map_impl::insert_range.
	(flat_multimap): Likewise.
	* include/std/flat_set (_Flat_set_impl::insert_range):
	Reimplement directly, not in terms of insert.
	(flat_set): Export _Flat_set_impl::insert_range.
	(flat_multiset): Likewise.
	* testsuite/23_containers/flat_map/1.cc (test06): New test.
	* testsuite/23_containers/flat_multimap/1.cc (test06): New test.
	* testsuite/23_containers/flat_multiset/1.cc (test06): New test.
	* testsuite/23_containers/flat_set/1.cc (test06): New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Implement C++23 &lt;flat_map&gt; (P0429R9)</title>
<updated>2024-12-19T16:31:09+00:00</updated>
<author>
<name>Patrick Palka</name>
<email>ppalka@redhat.com</email>
</author>
<published>2024-12-19T16:31:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=92381894b36b39030e6a264d3da2204b20f08d6c'/>
<id>92381894b36b39030e6a264d3da2204b20f08d6c</id>
<content type='text'>
This implements the C++23 container adaptors std::flat_map and
std::flat_multimap from P0429R9.  The implementation is shared
as much as possible between the two adaptors via a common base
class that's parameterized according to key uniqueness.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Add new header &lt;flat_map&gt;.
	* include/Makefile.in: Regenerate.
	* include/bits/alloc_traits.h (__not_allocator_like): New concept.
	* include/bits/stl_function.h (__transparent_comparator): Likewise.
	* include/bits/stl_iterator_base_types.h (__has_input_iter_cat):
	Likewise.
	* include/bits/uses_allocator.h (__allocator_for): Likewise.
	* include/bits/utility.h (sorted_unique_t): Define for C++23.
	(sorted_unique): Likewise.
	(sorted_equivalent_t): Likewise.
	(sorted_equivalent): Likewise.
	* include/bits/version.def (flat_map): Define.
	* include/bits/version.h: Regenerate.
	* include/precompiled/stdc++.h: Include &lt;flat_map&gt;.
	* include/std/flat_map: New file.
	* src/c++23/std.cc.in: Export &lt;flat_map&gt;.
	* testsuite/23_containers/flat_map/1.cc: New test.
	* testsuite/23_containers/flat_multimap/1.cc: New test.

Co-authored-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements the C++23 container adaptors std::flat_map and
std::flat_multimap from P0429R9.  The implementation is shared
as much as possible between the two adaptors via a common base
class that's parameterized according to key uniqueness.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Add new header &lt;flat_map&gt;.
	* include/Makefile.in: Regenerate.
	* include/bits/alloc_traits.h (__not_allocator_like): New concept.
	* include/bits/stl_function.h (__transparent_comparator): Likewise.
	* include/bits/stl_iterator_base_types.h (__has_input_iter_cat):
	Likewise.
	* include/bits/uses_allocator.h (__allocator_for): Likewise.
	* include/bits/utility.h (sorted_unique_t): Define for C++23.
	(sorted_unique): Likewise.
	(sorted_equivalent_t): Likewise.
	(sorted_equivalent): Likewise.
	* include/bits/version.def (flat_map): Define.
	* include/bits/version.h: Regenerate.
	* include/precompiled/stdc++.h: Include &lt;flat_map&gt;.
	* include/std/flat_map: New file.
	* src/c++23/std.cc.in: Export &lt;flat_map&gt;.
	* testsuite/23_containers/flat_map/1.cc: New test.
	* testsuite/23_containers/flat_multimap/1.cc: New test.

Co-authored-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
