[PATCH] D131486: [llvm][ADT] Allow using structured bindings with `llvm::enumerate`

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 07:52:44 PDT 2022


kuhar added a comment.

Neat!

> The order of index first, before value was mainly chosen to stay consistent with the current documentation of llvm::enumerate, but I'd personally be open to (and would have a slight preference of) swapping the order of the two as well.

I'd *personally* prefer to keep it as `index, value`, because that's the order in python, rust, and swift.



================
Comment at: llvm/unittests/ADT/STLExtrasTest.cpp:94-95
 
   for (auto X : llvm::enumerate(foo)) {
     ++X.value();
   }
----------------
Can we also have a test that updates the value? I'm not sure if this is currently supported based on the `get` function.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131486/new/

https://reviews.llvm.org/D131486



More information about the llvm-commits mailing list