<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gcc.git/libstdc++-v3/include/std/functional, 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++: Use _Bind_front_t/_Bind_back_t in bind_front&lt;f&gt;/bind_back&lt;f&gt; [PR122032]</title>
<updated>2025-11-14T11:38:27+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-10-24T08:24:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=71004c2414337bd781e1221acbcca2031bb6b614'/>
<id>71004c2414337bd781e1221acbcca2031bb6b614</id>
<content type='text'>
This patch changes the implementation of bind_front&lt;f&gt; and bind_back&lt;f&gt; to
return a _Bind_front_t&lt;_Bind_fn_t&lt;f&gt;, ...&gt; and _Bind_back_t&lt;_Bind_fn_t&lt;f&gt;, ...&gt;
respectively, replacing the previous lambda-based implementation. The prior use
of a lambda caused non-conforming behavior with respect to C++23 [func.require]
p8, which requires that bind_front&lt;f&gt;(s), bind_front&lt;f&gt;(move(s)), and
bind_front&lt;f&gt;(as_const(s)) produce the same type.

Additionally, using specialized structs reduces the size of the resulting functor
in certain scenarios (see PR).

For the zero-argument case, the function still returns a _Bind_fn_t&lt;f&gt;. Since this
type is already a perfect forwarding call wrapper, it yields the same result as
_Bind_front_t&lt;_Bind_fn_t&lt;f&gt;&gt;.

A consequence of this change is that the types returned by bind_front&lt;f&gt;(args...)
and bind_back&lt;f&gt;(args...) are no longer structural - they are not required to be
structural by the standard.

	PR libstdc++/122032

libstdc++-v3/ChangeLog:

	* include/std/functional (std::bind_front&lt;f&gt;, std::bind_back&lt;f&gt;):
	Define in terms of _Bind_front_t/_Bind_back_t.
	* testsuite/20_util/function_objects/bind_back/nttp.cc: New tests.
	* testsuite/20_util/function_objects/bind_front/nttp.cc: New tests.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch changes the implementation of bind_front&lt;f&gt; and bind_back&lt;f&gt; to
return a _Bind_front_t&lt;_Bind_fn_t&lt;f&gt;, ...&gt; and _Bind_back_t&lt;_Bind_fn_t&lt;f&gt;, ...&gt;
respectively, replacing the previous lambda-based implementation. The prior use
of a lambda caused non-conforming behavior with respect to C++23 [func.require]
p8, which requires that bind_front&lt;f&gt;(s), bind_front&lt;f&gt;(move(s)), and
bind_front&lt;f&gt;(as_const(s)) produce the same type.

Additionally, using specialized structs reduces the size of the resulting functor
in certain scenarios (see PR).

For the zero-argument case, the function still returns a _Bind_fn_t&lt;f&gt;. Since this
type is already a perfect forwarding call wrapper, it yields the same result as
_Bind_front_t&lt;_Bind_fn_t&lt;f&gt;&gt;.

A consequence of this change is that the types returned by bind_front&lt;f&gt;(args...)
and bind_back&lt;f&gt;(args...) are no longer structural - they are not required to be
structural by the standard.

	PR libstdc++/122032

libstdc++-v3/ChangeLog:

	* include/std/functional (std::bind_front&lt;f&gt;, std::bind_back&lt;f&gt;):
	Define in terms of _Bind_front_t/_Bind_back_t.
	* testsuite/20_util/function_objects/bind_back/nttp.cc: New tests.
	* testsuite/20_util/function_objects/bind_front/nttp.cc: New tests.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Forward arguments for bind_front&lt;f&gt;,bind_back&lt;f&gt;,nttp&lt;f&gt; [PR122022]</title>
<updated>2025-10-24T12:41:28+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-10-24T07:37:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=f27b8040ec8f2273cffbce7b66e94c323c53c32c'/>
<id>f27b8040ec8f2273cffbce7b66e94c323c53c32c</id>
<content type='text'>
This patch fixes a missing forwarding-reference (&amp;&amp;) in _Bind_fn_t::operator()
and lambda returned from not_fn&lt;f&gt;.

The bind_front&lt;f&gt;/bind_back&lt;f&gt; tests were updated to use a structure similar
to r16-3398-g250dd5b5604fbc to cover cases involving zero, one, and many bound
arguments.

	PR libstdc++/122022

libstdc++-v3/ChangeLog:

	* include/std/functional (_Bind_fn_t): Use forwarding reference as
	paremeter.
	(std::not_fn&lt;f&gt;): Use forwarding reference as lambda parameter.
	* testsuite/20_util/function_objects/bind_back/nttp.cc: Rework tests.
	* testsuite/20_util/function_objects/bind_front/nttp.cc: Likewise.
	* testsuite/20_util/function_objects/not_fn/nttp.cc: Add test for
	argument forwarding.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes a missing forwarding-reference (&amp;&amp;) in _Bind_fn_t::operator()
and lambda returned from not_fn&lt;f&gt;.

The bind_front&lt;f&gt;/bind_back&lt;f&gt; tests were updated to use a structure similar
to r16-3398-g250dd5b5604fbc to cover cases involving zero, one, and many bound
arguments.

	PR libstdc++/122022

libstdc++-v3/ChangeLog:

	* include/std/functional (_Bind_fn_t): Use forwarding reference as
	paremeter.
	(std::not_fn&lt;f&gt;): Use forwarding reference as lambda parameter.
	* testsuite/20_util/function_objects/bind_back/nttp.cc: Rework tests.
	* testsuite/20_util/function_objects/bind_front/nttp.cc: Likewise.
	* testsuite/20_util/function_objects/not_fn/nttp.cc: Add test for
	argument forwarding.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Add NTTP bind_front, -back, not_fn (P2714) [PR119744]</title>
<updated>2025-09-19T21:31:31+00:00</updated>
<author>
<name>Nathan Myers</name>
<email>ncm@cantrip.org</email>
</author>
<published>2025-07-03T21:15:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=a77146f01563b5df19e70061dc237178b5532aa9'/>
<id>a77146f01563b5df19e70061dc237178b5532aa9</id>
<content type='text'>
Add non-type template parameter function-object/-pointer argument
versions of bind_front, bind_back, and not_fn.

This introduces a new internal type _Bind_fn_t to carry the
template-argument function object when no arguments are bound,
used in both bind_front and bind_back. Otherwise they return
a lambda object that has captured the arguments.

There is no need to change libstdc++-v3/src/c++23/std.cc.in
because existing exports: "using std::bind_front;" etc. export
the new overloads.

libstdc++-v3/ChangeLog:
	PR libstdc++/119744
	* include/bits/version.def: Redefine __cpp_lib_bind_front etc.
	* include/bits/version.h: Ditto.
	* include/std/functional: Add new bind_front etc. overloads
	* testsuite/20_util/function_objects/bind_back/1.cc:
	Check plumbing better
	* testsuite/20_util/function_objects/bind_back/nttp.cc: New test.
	* testsuite/20_util/function_objects/bind_back/nttp_neg.cc: New test.
	* testsuite/20_util/function_objects/bind_front/1.cc:
	Check plumbing better
	* testsuite/20_util/function_objects/bind_front/nttp.cc: New test.
	* testsuite/20_util/function_objects/bind_front/nttp_neg.cc: New test.
	* testsuite/20_util/function_objects/not_fn/nttp.cc: New test.
	* testsuite/20_util/function_objects/not_fn/nttp_neg.cc: New test.
	* testsuite/20_util/headers/functional/synopsis.cc: New decls.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add non-type template parameter function-object/-pointer argument
versions of bind_front, bind_back, and not_fn.

This introduces a new internal type _Bind_fn_t to carry the
template-argument function object when no arguments are bound,
used in both bind_front and bind_back. Otherwise they return
a lambda object that has captured the arguments.

There is no need to change libstdc++-v3/src/c++23/std.cc.in
because existing exports: "using std::bind_front;" etc. export
the new overloads.

libstdc++-v3/ChangeLog:
	PR libstdc++/119744
	* include/bits/version.def: Redefine __cpp_lib_bind_front etc.
	* include/bits/version.h: Ditto.
	* include/std/functional: Add new bind_front etc. overloads
	* testsuite/20_util/function_objects/bind_back/1.cc:
	Check plumbing better
	* testsuite/20_util/function_objects/bind_back/nttp.cc: New test.
	* testsuite/20_util/function_objects/bind_back/nttp_neg.cc: New test.
	* testsuite/20_util/function_objects/bind_front/1.cc:
	Check plumbing better
	* testsuite/20_util/function_objects/bind_front/nttp.cc: New test.
	* testsuite/20_util/function_objects/bind_front/nttp_neg.cc: New test.
	* testsuite/20_util/function_objects/not_fn/nttp.cc: New test.
	* testsuite/20_util/function_objects/not_fn/nttp_neg.cc: New test.
	* testsuite/20_util/headers/functional/synopsis.cc: New decls.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Fix algorithms to use iterators' difference_type for arithmetic [PR121890]</title>
<updated>2025-09-12T20:46:48+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-09-10T11:00:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=7b99d184bc9eada80992f7134c6c8e3b0eb0d19d'/>
<id>7b99d184bc9eada80992f7134c6c8e3b0eb0d19d</id>
<content type='text'>
Whenever we use operator+ or similar operators on random access
iterators we need to be careful to use the iterator's difference_type
rather than some other integer type. It's not guaranteed that an
expression with an arbitrary integer type, such as `it + 1u`, has the
same effects as `it + iter_difference_t&lt;It&gt;(1)`.

Some of our algorithms need changes to cast values to the correct type,
or to use std::next or ranges::next instead of `it + n`. Several tests
also need fixes where the arithmetic occurs directly in the test.

The __gnu_test::random_access_iterator_wrapper class template is
adjusted to have deleted operators that make programs ill-formed if the
argument to relevant operators is not the difference_type. This will
make it easier to avoid regressing in future.

libstdc++-v3/ChangeLog:

	PR libstdc++/121890
	* include/bits/ranges_algo.h (ranges::rotate, ranges::shuffle)
	(__insertion_sort, __unguarded_partition_pivot, __introselect):
	Use ranges::next to advance iterators. Use local variables in
	rotate to avoid duplicate expressions.
	(ranges::push_heap, ranges::pop_heap, ranges::partial_sort)
	(ranges::partial_sort_copy): Use ranges::prev.
	(__final_insertion_sort): Use iter_difference_t&lt;Iter&gt;
	for operand of operator+ on iterator.
	* include/bits/ranges_base.h (ranges::advance): Use iterator's
	difference_type for all iterator arithmetic.
	* include/bits/stl_algo.h (__search_n_aux, __rotate)
	(__insertion_sort, __unguarded_partition_pivot, __introselect)
	(__final_insertion_sort, for_each_n, random_shuffle): Likewise.
	Use local variables in __rotate to avoid duplicate expressions.
	* include/bits/stl_algobase.h (__fill_n_a, __lc_rai::__newlast1):
	Likewise.
	* include/bits/stl_heap.h (push_heap): Likewise.
	(__is_heap_until): Add static_assert.
	(__is_heap): Convert distance to difference_type.
	* include/std/functional (boyer_moore_searcher::operator()): Use
	iterator's difference_type for iterator arithmetic.
	* testsuite/util/testsuite_iterators.h
	(random_access_iterator_wrapper): Add deleted overloads of
	operators that should be called with difference_type.
	* testsuite/24_iterators/range_operations/advance.cc: Use
	ranges::next.
	* testsuite/25_algorithms/heap/constrained.cc: Use ranges::next
	and ranges::prev.
	* testsuite/25_algorithms/nth_element/58800.cc: Use std::next.
	* testsuite/25_algorithms/nth_element/constrained.cc: Use
	ptrdiff_t for loop variable.
	* testsuite/25_algorithms/nth_element/random_test.cc: Use
	iterator's difference_type instead of int.
	* testsuite/25_algorithms/partial_sort/check_compare_by_value.cc:
	Use std::next.
	* testsuite/25_algorithms/partial_sort/constrained.cc: Use
	ptrdiff_t for loop variable.
	* testsuite/25_algorithms/partial_sort/random_test.cc: Use
	iterator's difference_type instead of int.
	* testsuite/25_algorithms/partial_sort_copy/constrained.cc:
	Use ptrdiff_t for loop variable.
	* testsuite/25_algorithms/partial_sort_copy/random_test.cc:
	Use iterator's difference_type instead of int.
	* testsuite/std/ranges/adaptors/drop.cc: Use ranges::next.
	* testsuite/25_algorithms/fill_n/diff_type.cc: New test.
	* testsuite/25_algorithms/lexicographical_compare/diff_type.cc:
	New test.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Whenever we use operator+ or similar operators on random access
iterators we need to be careful to use the iterator's difference_type
rather than some other integer type. It's not guaranteed that an
expression with an arbitrary integer type, such as `it + 1u`, has the
same effects as `it + iter_difference_t&lt;It&gt;(1)`.

Some of our algorithms need changes to cast values to the correct type,
or to use std::next or ranges::next instead of `it + n`. Several tests
also need fixes where the arithmetic occurs directly in the test.

The __gnu_test::random_access_iterator_wrapper class template is
adjusted to have deleted operators that make programs ill-formed if the
argument to relevant operators is not the difference_type. This will
make it easier to avoid regressing in future.

libstdc++-v3/ChangeLog:

	PR libstdc++/121890
	* include/bits/ranges_algo.h (ranges::rotate, ranges::shuffle)
	(__insertion_sort, __unguarded_partition_pivot, __introselect):
	Use ranges::next to advance iterators. Use local variables in
	rotate to avoid duplicate expressions.
	(ranges::push_heap, ranges::pop_heap, ranges::partial_sort)
	(ranges::partial_sort_copy): Use ranges::prev.
	(__final_insertion_sort): Use iter_difference_t&lt;Iter&gt;
	for operand of operator+ on iterator.
	* include/bits/ranges_base.h (ranges::advance): Use iterator's
	difference_type for all iterator arithmetic.
	* include/bits/stl_algo.h (__search_n_aux, __rotate)
	(__insertion_sort, __unguarded_partition_pivot, __introselect)
	(__final_insertion_sort, for_each_n, random_shuffle): Likewise.
	Use local variables in __rotate to avoid duplicate expressions.
	* include/bits/stl_algobase.h (__fill_n_a, __lc_rai::__newlast1):
	Likewise.
	* include/bits/stl_heap.h (push_heap): Likewise.
	(__is_heap_until): Add static_assert.
	(__is_heap): Convert distance to difference_type.
	* include/std/functional (boyer_moore_searcher::operator()): Use
	iterator's difference_type for iterator arithmetic.
	* testsuite/util/testsuite_iterators.h
	(random_access_iterator_wrapper): Add deleted overloads of
	operators that should be called with difference_type.
	* testsuite/24_iterators/range_operations/advance.cc: Use
	ranges::next.
	* testsuite/25_algorithms/heap/constrained.cc: Use ranges::next
	and ranges::prev.
	* testsuite/25_algorithms/nth_element/58800.cc: Use std::next.
	* testsuite/25_algorithms/nth_element/constrained.cc: Use
	ptrdiff_t for loop variable.
	* testsuite/25_algorithms/nth_element/random_test.cc: Use
	iterator's difference_type instead of int.
	* testsuite/25_algorithms/partial_sort/check_compare_by_value.cc:
	Use std::next.
	* testsuite/25_algorithms/partial_sort/constrained.cc: Use
	ptrdiff_t for loop variable.
	* testsuite/25_algorithms/partial_sort/random_test.cc: Use
	iterator's difference_type instead of int.
	* testsuite/25_algorithms/partial_sort_copy/constrained.cc:
	Use ptrdiff_t for loop variable.
	* testsuite/25_algorithms/partial_sort_copy/random_test.cc:
	Use iterator's difference_type instead of int.
	* testsuite/std/ranges/adaptors/drop.cc: Use ranges::next.
	* testsuite/25_algorithms/fill_n/diff_type.cc: New test.
	* testsuite/25_algorithms/lexicographical_compare/diff_type.cc:
	New test.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Enforce Mandates: for Boyer-Moore searchers</title>
<updated>2025-09-10T22:24:10+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-09-05T10:44:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=a559f1423cd72c40a9467429f0fcb14435bf7dcf'/>
<id>a559f1423cd72c40a9467429f0fcb14435bf7dcf</id>
<content type='text'>
C++17 has a 'Requires:' precondition that the two random access iterator
types have the same value type. In C++20 that is a 'Mandates:'
requirement which we must diagnose.

Although we could diagnose it in C++17, that might be a breaking change
for any users relying on it today. Also I am lazy and wanted to use
C++20's std::iter_value_t for the checks. So this only enforces the
requirement for C++20 and later.

libstdc++-v3/ChangeLog:

	* include/std/functional (boyer_moore_searcher::operator()): Add
	static_assert.
	(boyer_moore_horspool_searcher::operator()): Likewise.
	* testsuite/20_util/function_objects/121782.cc: New test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
C++17 has a 'Requires:' precondition that the two random access iterator
types have the same value type. In C++20 that is a 'Mandates:'
requirement which we must diagnose.

Although we could diagnose it in C++17, that might be a breaking change
for any users relying on it today. Also I am lazy and wanted to use
C++20's std::iter_value_t for the checks. So this only enforces the
requirement for C++20 and later.

libstdc++-v3/ChangeLog:

	* include/std/functional (boyer_moore_searcher::operator()): Add
	static_assert.
	(boyer_moore_horspool_searcher::operator()): Likewise.
	* testsuite/20_util/function_objects/121782.cc: New test.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Move _Binder and related aliases to separate file.</title>
<updated>2025-09-04T13:29:36+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-09-01T12:28:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=b2adb7712cc57920d7d791c185dbf88e83b885c2'/>
<id>b2adb7712cc57920d7d791c185dbf88e83b885c2</id>
<content type='text'>
bits/binders.h is already mapped in libstdc++-v3/doc/doxygen/stdheader.cc.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Add bits/binders.h
	* include/Makefile.in: Add bits/binders.h
	* include/std/functional (std::_Indexed_bound_arg, std::_Binder)
	(std::__make_bound_args, std::_Bind_front_t, std::_Bind_back_t):
	Moved to bits/binders.h file, that is now included.
	* include/bits/binders.h: New file.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
bits/binders.h is already mapped in libstdc++-v3/doc/doxygen/stdheader.cc.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Add bits/binders.h
	* include/Makefile.in: Add bits/binders.h
	* include/std/functional (std::_Indexed_bound_arg, std::_Binder)
	(std::__make_bound_args, std::_Bind_front_t, std::_Bind_back_t):
	Moved to bits/binders.h file, that is now included.
	* include/bits/binders.h: New file.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Merge bind_front and bind_back binders</title>
<updated>2025-09-04T13:28:57+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-08-27T10:33:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=2c2df024df3aa6248f92203df9c1051b5f1fe5f8'/>
<id>2c2df024df3aa6248f92203df9c1051b5f1fe5f8</id>
<content type='text'>
The _Bind_front and _Bind_back class templates are now merged into a single
_Binder implementation that accepts _Back as a template parameter. This makes
the bind_back implementation available in C++20 mode, allowing it to be used
for range adaptor closures.

With zero bound arguments, bind_back and bind_front have equivalent
functionality. Consequently, _Bind_back_t now produces the same type as
bind_front (_Binder&lt;false, _Fd&gt;). A simple copy of the functor cannot be
returned in this case, as it would visibly affect overload resolution
(see included test cases).

We also replace std::invoke in internal functions, with std::__invoke.

libstdc++-v3/ChangeLog:

	* include/std/functional: (std::_Indexed_bound_arg): Fixed
	indentation.
	(__Bound_arg_storage::_S_apply_front)
	(__Bound_arg_storage::_S_apply_front): Merged into _S_apply.
	(__Bound_arg_storage::_S_apply): Merged above, add _Back template
	parameter, replace std::invoke with std::__invoke.
	(std::_Bind_front): Renamed to std::_Binder and add _Back
	template parameter.
	(std::_Binder): Renamed from std::_Bind_front.
	(_Binder::_Result_t, _Binder::_S_noexcept_invoke): Define.
	(_Binder::operator()): Use _Result_t and _S_noexcept_invoke.
	(_Binder::_S_call): Handle zero args specially, replace std::invoke
	with std::__invoke.
	(std::_Bind_front_t, std::_Bind_back_t): Defined in terms
	of _Binder.
	(std::_Bind_back): Merged into _Binder.
	* testsuite/20_util/function_objects/bind_back/1.cc: New tests.
	* testsuite/20_util/function_objects/bind_back/111327.cc: Updated
	error messages.
	* testsuite/20_util/function_objects/bind_front/1.cc: New tests.
	* testsuite/20_util/function_objects/bind_front/111327.cc: Updated
	error messages.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The _Bind_front and _Bind_back class templates are now merged into a single
_Binder implementation that accepts _Back as a template parameter. This makes
the bind_back implementation available in C++20 mode, allowing it to be used
for range adaptor closures.

With zero bound arguments, bind_back and bind_front have equivalent
functionality. Consequently, _Bind_back_t now produces the same type as
bind_front (_Binder&lt;false, _Fd&gt;). A simple copy of the functor cannot be
returned in this case, as it would visibly affect overload resolution
(see included test cases).

We also replace std::invoke in internal functions, with std::__invoke.

libstdc++-v3/ChangeLog:

	* include/std/functional: (std::_Indexed_bound_arg): Fixed
	indentation.
	(__Bound_arg_storage::_S_apply_front)
	(__Bound_arg_storage::_S_apply_front): Merged into _S_apply.
	(__Bound_arg_storage::_S_apply): Merged above, add _Back template
	parameter, replace std::invoke with std::__invoke.
	(std::_Bind_front): Renamed to std::_Binder and add _Back
	template parameter.
	(std::_Binder): Renamed from std::_Bind_front.
	(_Binder::_Result_t, _Binder::_S_noexcept_invoke): Define.
	(_Binder::operator()): Use _Result_t and _S_noexcept_invoke.
	(_Binder::_S_call): Handle zero args specially, replace std::invoke
	with std::__invoke.
	(std::_Bind_front_t, std::_Bind_back_t): Defined in terms
	of _Binder.
	(std::_Bind_back): Merged into _Binder.
	* testsuite/20_util/function_objects/bind_back/1.cc: New tests.
	* testsuite/20_util/function_objects/bind_back/111327.cc: Updated
	error messages.
	* testsuite/20_util/function_objects/bind_front/1.cc: New tests.
	* testsuite/20_util/function_objects/bind_front/111327.cc: Updated
	error messages.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Refactor bound arguments storage for bind_front/back</title>
<updated>2025-08-26T16:16:04+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-08-19T13:32:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=250dd5b5604fbc9149e30f6b9cfaabdd600592e7'/>
<id>250dd5b5604fbc9149e30f6b9cfaabdd600592e7</id>
<content type='text'>
This patch refactors the implementation of bind_front and bind_back to avoid
using std::tuple for argument storage. Instead, bound arguments are now:
* stored directly if there is only one,
* within a dedicated _Bound_arg_storage otherwise.

_Bound_arg_storage is less expensive to instantiate and access than std::tuple.
It can also be trivially copyable, as it doesn't require a non-trivial assignment
operator for reference types. Storing a single argument directly provides similar
benefits compared to both one element tuple or _Bound_arg_storage.

_Bound_arg_storage holds each argument in an _Indexed_bound_arg base object.
The base class is parameterized by both type and index to allow storing
multiple arguments of the same type. Invocations are handled by _S_apply_front
amd _S_apply_back static functions, which simulate explicit object parameters.
To facilitate this, the __like_t alias template is now unconditionally available
since C++11 in bits/move.h.

libstdc++-v3/ChangeLog:

	* include/bits/move.h (std::__like_impl, std::__like_t): Make
	available in c++11.
	* include/std/functional (std::_Indexed_bound_arg)
	(std::_Bound_arg_storage, std::__make_bound_args): Define.
	(std::_Bind_front, std::_Bind_back): Use _Bound_arg_storage.
	* testsuite/20_util/function_objects/bind_back/1.cc: Expand
	test to cover cases of 0, 1, many bound args.
	* testsuite/20_util/function_objects/bind_back/111327.cc: Likewise.
	* testsuite/20_util/function_objects/bind_front/1.cc: Likewise.
	* testsuite/20_util/function_objects/bind_front/111327.cc: Likewise.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch refactors the implementation of bind_front and bind_back to avoid
using std::tuple for argument storage. Instead, bound arguments are now:
* stored directly if there is only one,
* within a dedicated _Bound_arg_storage otherwise.

_Bound_arg_storage is less expensive to instantiate and access than std::tuple.
It can also be trivially copyable, as it doesn't require a non-trivial assignment
operator for reference types. Storing a single argument directly provides similar
benefits compared to both one element tuple or _Bound_arg_storage.

_Bound_arg_storage holds each argument in an _Indexed_bound_arg base object.
The base class is parameterized by both type and index to allow storing
multiple arguments of the same type. Invocations are handled by _S_apply_front
amd _S_apply_back static functions, which simulate explicit object parameters.
To facilitate this, the __like_t alias template is now unconditionally available
since C++11 in bits/move.h.

libstdc++-v3/ChangeLog:

	* include/bits/move.h (std::__like_impl, std::__like_t): Make
	available in c++11.
	* include/std/functional (std::_Indexed_bound_arg)
	(std::_Bound_arg_storage, std::__make_bound_args): Define.
	(std::_Bind_front, std::_Bind_back): Use _Bound_arg_storage.
	* testsuite/20_util/function_objects/bind_back/1.cc: Expand
	test to cover cases of 0, 1, many bound args.
	* testsuite/20_util/function_objects/bind_back/111327.cc: Likewise.
	* testsuite/20_util/function_objects/bind_front/1.cc: Likewise.
	* testsuite/20_util/function_objects/bind_front/111327.cc: Likewise.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Implement C++26 function_ref [PR119126]</title>
<updated>2025-05-26T09:25:28+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-05-14T10:04:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=545433e9bd32e965726956cb238d53b39844b85c'/>
<id>545433e9bd32e965726956cb238d53b39844b85c</id>
<content type='text'>
This patch implements C++26 function_ref as specified in P0792R14,
with correction for constraints for constructor accepting nontype_t
parameter from LWG 4256.

As function_ref may store a pointer to the const object, __Ptrs::_M_obj is
changed to const void*, so again we do not cast away const from const
objects. To help with necessary casts, a __polyfunc::__cast_to helper is
added, that accepts reference to or target type direclty.

The _Invoker now defines additional call methods used by function_ref:
_S_ptrs() for invoking target passed by reference, and __S_nttp, _S_bind_ptr,
_S_bind_ref for handling constructors accepting nontype_t. The existing
_S_call_storage is changed to thin wrapper, that initialies _Ptrs, and forwards
to _S_call_ptrs.

This reduced the most uses of _Storage::_M_ptr and _Storage::_M_ref,
so this functions was removed, and _Manager uses were adjusted.

Finally we make function_ref available in freestanding mode, as
move_only_function and copyable_function are currently only available in hosted,
so we define _Manager and _Mo_base only if either __glibcxx_move_only_function
or __glibcxx_copyable_function is defined.

	PR libstdc++/119126

libstdc++-v3/ChangeLog:

	* doc/doxygen/stdheader.cc: Added funcref_impl.h file.
	* include/Makefile.am: Added funcref_impl.h file.
	* include/Makefile.in: Added funcref_impl.h file.
	* include/bits/funcref_impl.h: New file.
	* include/bits/funcwrap.h: (_Ptrs::_M_obj): Const-qualify.
	(_Storage::_M_ptr, _Storage::_M_ref): Remove.
	(__polyfunc::__cast_to) Define.
	(_Base_invoker::_S_ptrs, _Base_invoker::_S_nttp)
	(_Base_invoker::_S_bind_ptrs, _Base_invoker::_S_bind_ref)
	(_Base_invoker::_S_call_ptrs): Define.
	(_Base_invoker::_S_call_storage): Foward to _S_call_ptrs.
	(_Manager::_S_local, _Manager::_S_ptr): Adjust for _M_obj being
	const qualified.
	(__polyfunc::_Manager, __polyfunc::_Mo_base): Guard with
	__glibcxx_move_only_function || __glibcxx_copyable_function.
	(__polyfunc::__skip_first_arg, __polyfunc::__deduce_funcref)
	(std::function_ref) [__glibcxx_function_ref]: Define.
	* include/bits/utility.h (std::nontype_t, std::nontype)
	(__is_nontype_v) [__glibcxx_function_ref]: Define.
	* include/bits/version.def: Define function_ref.
	* include/bits/version.h: Regenerate.
	* include/std/functional: Define __cpp_lib_function_ref.
	* src/c++23/std.cc.in (std::nontype_t, std::nontype)
	(std::function_ref) [__cpp_lib_function_ref]: Export.
	* testsuite/20_util/function_ref/assign.cc: New test.
	* testsuite/20_util/function_ref/call.cc: New test.
	* testsuite/20_util/function_ref/cons.cc: New test.
	* testsuite/20_util/function_ref/cons_neg.cc: New test.
	* testsuite/20_util/function_ref/conv.cc: New test.
	* testsuite/20_util/function_ref/deduction.cc: New test.
	* testsuite/20_util/function_ref/mutation.cc: New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch implements C++26 function_ref as specified in P0792R14,
with correction for constraints for constructor accepting nontype_t
parameter from LWG 4256.

As function_ref may store a pointer to the const object, __Ptrs::_M_obj is
changed to const void*, so again we do not cast away const from const
objects. To help with necessary casts, a __polyfunc::__cast_to helper is
added, that accepts reference to or target type direclty.

The _Invoker now defines additional call methods used by function_ref:
_S_ptrs() for invoking target passed by reference, and __S_nttp, _S_bind_ptr,
_S_bind_ref for handling constructors accepting nontype_t. The existing
_S_call_storage is changed to thin wrapper, that initialies _Ptrs, and forwards
to _S_call_ptrs.

This reduced the most uses of _Storage::_M_ptr and _Storage::_M_ref,
so this functions was removed, and _Manager uses were adjusted.

Finally we make function_ref available in freestanding mode, as
move_only_function and copyable_function are currently only available in hosted,
so we define _Manager and _Mo_base only if either __glibcxx_move_only_function
or __glibcxx_copyable_function is defined.

	PR libstdc++/119126

libstdc++-v3/ChangeLog:

	* doc/doxygen/stdheader.cc: Added funcref_impl.h file.
	* include/Makefile.am: Added funcref_impl.h file.
	* include/Makefile.in: Added funcref_impl.h file.
	* include/bits/funcref_impl.h: New file.
	* include/bits/funcwrap.h: (_Ptrs::_M_obj): Const-qualify.
	(_Storage::_M_ptr, _Storage::_M_ref): Remove.
	(__polyfunc::__cast_to) Define.
	(_Base_invoker::_S_ptrs, _Base_invoker::_S_nttp)
	(_Base_invoker::_S_bind_ptrs, _Base_invoker::_S_bind_ref)
	(_Base_invoker::_S_call_ptrs): Define.
	(_Base_invoker::_S_call_storage): Foward to _S_call_ptrs.
	(_Manager::_S_local, _Manager::_S_ptr): Adjust for _M_obj being
	const qualified.
	(__polyfunc::_Manager, __polyfunc::_Mo_base): Guard with
	__glibcxx_move_only_function || __glibcxx_copyable_function.
	(__polyfunc::__skip_first_arg, __polyfunc::__deduce_funcref)
	(std::function_ref) [__glibcxx_function_ref]: Define.
	* include/bits/utility.h (std::nontype_t, std::nontype)
	(__is_nontype_v) [__glibcxx_function_ref]: Define.
	* include/bits/version.def: Define function_ref.
	* include/bits/version.h: Regenerate.
	* include/std/functional: Define __cpp_lib_function_ref.
	* src/c++23/std.cc.in (std::nontype_t, std::nontype)
	(std::function_ref) [__cpp_lib_function_ref]: Export.
	* testsuite/20_util/function_ref/assign.cc: New test.
	* testsuite/20_util/function_ref/call.cc: New test.
	* testsuite/20_util/function_ref/cons.cc: New test.
	* testsuite/20_util/function_ref/cons_neg.cc: New test.
	* testsuite/20_util/function_ref/conv.cc: New test.
	* testsuite/20_util/function_ref/deduction.cc: New test.
	* testsuite/20_util/function_ref/mutation.cc: New test.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Renamed bits/move_only_function.h to bits/funcwrap.h [PR119125]</title>
<updated>2025-05-14T13:00:41+00:00</updated>
<author>
<name>Tomasz Kamiński</name>
<email>tkaminsk@redhat.com</email>
</author>
<published>2025-05-12T09:06:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=d9055d010475fa1c624d6036881eee9c37034b21'/>
<id>d9055d010475fa1c624d6036881eee9c37034b21</id>
<content type='text'>
The file now includes copyable_function in addition to
move_only_function.

	PR libstdc++/119125

libstdc++-v3/ChangeLog:
	* include/bits/move_only_function.h: Move to...
	* include/bits/funcwrap.h: ...here.
	* doc/doxygen/stdheader.cc (init_map): Replaced move_only_function.h
	with funcwrap.h, and changed include guard to use feature test macro.
	Move bits/version.h include before others.
	* include/Makefile.am: Likewise.
	* include/Makefile.in: Likewise.
	* include/std/functional: Likewise.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The file now includes copyable_function in addition to
move_only_function.

	PR libstdc++/119125

libstdc++-v3/ChangeLog:
	* include/bits/move_only_function.h: Move to...
	* include/bits/funcwrap.h: ...here.
	* doc/doxygen/stdheader.cc (init_map): Replaced move_only_function.h
	with funcwrap.h, and changed include guard to use feature test macro.
	Move bits/version.h include before others.
	* include/Makefile.am: Likewise.
	* include/Makefile.in: Likewise.
	* include/std/functional: Likewise.

Reviewed-by: Patrick Palka &lt;ppalka@redhat.com&gt;
Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Signed-off-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
