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@lists.isocpp.org> On Behalf Of Oliver Schädlich via Std-Proposals
Sent: Saturday, May 11, 2024 09:00
To: std-proposals@lists.isocpp.org
Cc: Oliver Schädlich <oliver.schaedlich@gmail.com>
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;