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

Markus Böck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 08:00:20 PDT 2022


zero9178 added a comment.

In D131486#3709825 <https://reviews.llvm.org/D131486#3709825>, @kuhar wrote:

> 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.

That's a very good argument as well. I shall keep the current state then.



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


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