C++ Logo

std-proposals

Advanced search

Re: [std-proposals] C-style array specialization for std::get

From: Lénárd Szolnoki <cpp_at_[hidden]>
Date: Tue, 1 Mar 2022 18:25:36 +0000
Hi,

On Tue, 01 Mar 2022 18:10:25 +0000
Zhihao Yuan via Std-Proposals <std-proposals_at_[hidden]> wrote:

> On Tuesday, March 1st, 2022 at 9:40 AM, Arthur O'Dwyer via
> Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> > Nope; if you're supporting `std::get` for C arrays, the only reason
> > I can imagine for doing so is because you want to supportint arr[3]
> > = {1,2,3};int [a,b,c] = arr;and for that to work, you're going to
> > need tuple_size and tuple_element.
>
> I wouldn't say you don't want tuple_sizeand tuple_element, but they
> do nothingto structured binding. Structured bindingshave dedicated
> rules for C arrays[dcl.struct.bind] (eel.is) and it kicks inearly,
> ignoring all tuple_* stuff.

As you write, it wouldn't do anything for structured bindings, but it
would enable C arrays for `std::apply`.

> --
> Zhihao Yuan, ID lichray
>
> The best way to predict the future is to invent it.
>
> _______________________________________________

Cheers,
Lénárd Szolnoki

Received on 2022-03-01 18:25:45