Oh, thats https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2726r0.html

Hewill Kang <hewillk@gmail.com> 於 2025年11月17日 週一 下午3:37寫道:
This can now be easily done by providing an  `operator[] ` that takes an `integral-constant-like` for `tuple` :

  std::tuple t{'a', 0.42, 100};
  t[std::cw<0>] = 'b';
  t[std::cw<1>] = 0.0;
  t[std::cw<2>] = 5;

And the implementation can be simplified by duducing this.
Therefore, is providing an operator[] for a tuple more desirable feature than the this original proposal?


Jonathan Wakely via Std-Proposals <std-proposals@lists.isocpp.org> 於 2025年11月17日 週一 下午2:30寫道:


On Sun, 16 Nov 2025, 17:18 Bjorn Reese via Std-Proposals, <std-proposals@lists.isocpp.org> wrote:
On 11/16/25 16:42, Hewill Kang via Std-Proposals wrote:

> I think this might be a bit far-fetched, because it changes the
> long-standing expected use case of operator[]. More precisely, it
> provides a more complex overload for operator[]. I don't know if it's
> worth it.

Recall that we already have a special syntax with array bound checks for
tuple-like classes:

   std::array<int, 4> a{};
   auto v = std::get<42>(a);


Yes, but if we could have supported accessing tuples as tup[N] I think most people would have preferred that!

The get<N> syntax is a less-than-ideal hack.


--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals