[Bug libstdc++/107572] cartesian_product_view invokes the begin of input_range twice

2023-03-09 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107572

Patrick Palka  changed:

   What|Removed |Added

   Target Milestone|--- |13.0
 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Patrick Palka  ---
Should be fixed, thanks for catching this.

[Bug libstdc++/107572] cartesian_product_view invokes the begin of input_range twice

2023-03-09 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107572

--- Comment #1 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:3df9760d56662bdf38dd45f7398f003bbd64fdfe

commit r13-6558-g3df9760d56662bdf38dd45f7398f003bbd64fdfe
Author: Patrick Palka 
Date:   Thu Mar 9 13:25:44 2023 -0500

libstdc++: extraneous begin in cartesian_product_view::end [PR107572]

ranges::begin() isn't guaranteed to be equality-preserving for non-forward
ranges, so in cartesian_product_view::end we need to avoid needlessly
calling begin() on the first range (which could be non-forward) in the
case where __empty_tail is false as per its specification.

Since we're already using a variadic lambda to compute __empty_tail, we
might as well use that same lambda to build up the tuple of iterators
instead of building it separately via e.g. std::apply or __tuple_transform.

PR libstdc++/107572

libstdc++-v3/ChangeLog:

* include/std/ranges (cartesian_product_view::end): When
building the tuple of iterators, avoid calling ranges::begin on
the first range if __empty_tail is false.
* testsuite/std/ranges/cartesian_product/1.cc (test07): New test.

[Bug libstdc++/107572] cartesian_product_view invokes the begin of input_range twice

2023-03-07 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107572

Patrick Palka  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org

[Bug libstdc++/107572] cartesian_product_view invokes the begin of input_range twice

2022-11-08 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107572

Jonathan Wakely  changed:

   What|Removed |Added

 CC||ppalka at gcc dot gnu.org
 Ever confirmed|0   |1
   Last reconfirmed||2022-11-08
 Status|UNCONFIRMED |NEW