Код: Выделить всё
void process(int i);
...
for(auto i : items)
process(i);
Код: Выделить всё
std::ranges::for_each(items, process);
Код: Выделить всё
void process(int a, int b);
for(auto [a, b] : std::views::zip(itemsA, itemsB))
process(a, b);
Подробнее здесь: https://stackoverflow.com/questions/791 ... esfor-each
Мобильная версия