Date: Mon, 17 Nov 2025 06:30:01 +0000
On Sun, 16 Nov 2025, 17:18 Bjorn Reese via Std-Proposals, <
std-proposals_at_[hidden]> 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_at_[hidden]> 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.
Received on 2025-11-17 06:30:18
