Remix.run Logo
HarHarVeryFunny 9 hours ago

C++20 also has an enumerate() generator, so if you like the python syntax you can just do:

for (auto [i,v] : std::views::enumerate(vec)) std::cout << i << ": " << v << std::endl;

FWIW C++23 also has a python-like print and println:

std::println("{}: {}", i, v);