C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Structured binding without type inference

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Sat, 11 May 2024 09:58:44 +0000
I have found many instances where something like this would be useful, but I would go further to be able to define them like this:


pair<int, char> pic;
[int a, char& b] = pic; //distinct types



From: Std-Proposals <std-proposals-bounces_at_[hidden]> On Behalf Of Oliver Schädlich via Std-Proposals
Sent: Saturday, May 11, 2024 09:00
To: std-proposals_at_[hidden]
Cc: Oliver Schädlich <oliver.schaedlich_at_[hidden]>
Subject: [std-proposals] Structured binding without type inference


If all variables of a structured binding are the same I think structured
binding without type inference would improve the readability.

    pair<int, int> pii;
    int &[a, b] = pii;

Or:

    pair<int, char> pic;
    int [a, b] = pic;




Received on 2024-05-11 09:58:48