Date: Tue, 24 Oct 2023 08:40:23 +0000
Juniper Public
+AD4- From: Std-Proposals +ADw-std-proposals-bounces+AEA-lists.isocpp.org +ADw-mailto:std-proposals-bounces+AEA-lists.isocpp.org+AD4APg- on behalf of Frederick Virchanza Gotham via Std-Proposals +ADw-std-proposals+AEA-lists.isocpp.org +ADw-mailto:std-proposals+AEA-lists.isocpp.org+AD4APg-
+AD4- Date: Monday, October 23, 2023 at 4:49 PM
+AD4- I had proposed before that all 'for' loops should have an implicit variable '+AF8AXw-i' keeping count of the iterations, something like:
+AD4- for ( auto +ACY-e : my+AF8-vector ) SomeFunc( e, +AF8AXw-i )+ADs-
The standard already has that - that's what std::views::enumerate() provides.
And there's std::views::iota() if you only want a counter.
And the rumor is C+-+-26 will have std::views::upto(). (from https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1894r0.pdf)
-hadriel
+AD4- From: Std-Proposals +ADw-std-proposals-bounces+AEA-lists.isocpp.org +ADw-mailto:std-proposals-bounces+AEA-lists.isocpp.org+AD4APg- on behalf of Frederick Virchanza Gotham via Std-Proposals +ADw-std-proposals+AEA-lists.isocpp.org +ADw-mailto:std-proposals+AEA-lists.isocpp.org+AD4APg-
+AD4- Date: Monday, October 23, 2023 at 4:49 PM
+AD4- I had proposed before that all 'for' loops should have an implicit variable '+AF8AXw-i' keeping count of the iterations, something like:
+AD4- for ( auto +ACY-e : my+AF8-vector ) SomeFunc( e, +AF8AXw-i )+ADs-
The standard already has that - that's what std::views::enumerate() provides.
And there's std::views::iota() if you only want a counter.
And the rumor is C+-+-26 will have std::views::upto(). (from https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1894r0.pdf)
-hadriel
Received on 2023-10-24 08:40:29