|
|
|
|
|
by HarHarVeryFunny
21 days 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); |
|
C++ needs to abandon iostreams. Didn't the C++ community acknowledge that it was a bad idea? In the early days of D, people did want to do a version of it for D, but I objected and currently nobody wants it.