Hacker News new | ask | show | jobs
by HeavyStorm 18 days ago
Given both Lua and python use a enumerator, the C++ example isn't really the correct equivalent.

  for (auto [i, v] : std::views::enumerate(vec)) {
      std::cout << i << ": " << v << '\n';
  }
This is how you'd do it.
1 comments

True, but this is C++23, while the post is about C++20.