The current modern way for a for loop with fixed number of iterations probably would be to use iota.
#include <algorithm>
#include <ranges>
using std::ranges::for_each;
using std::ranges::views::iota;
int main()
{
for (auto i : iota(10))
Get();
// or
for_each(iota(10), [](auto i) {
Get();
});
}
-----Ursprüngliche Nachricht-----
Von: Frederick Virchanza Gotham via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Mo 23.10.2023 11:18
Betreff: [std-proposals] for ( repeat_count )
An: std-proposals <std-proposals@lists.isocpp.org>;
CC: Frederick Virchanza Gotham <cauldwell.thomas@gmail.com>;
What if the following:
for ( usigned i = 0u; i < len; ++i ) *p++ = Get();
Could be written as simply:
for ( len ) *p++ = Get();
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals