Date: Sun, 12 May 2024 10:16:48 +0100
On 12 May 2024 08:34:01 BST, Jan Schultke via Std-Proposals <std-proposals_at_[hidden]> wrote:
>The proposed syntax is a bit misleading because the type is still a
>std::pair, not an int. Something like what Tiago wrote would make sense,
>where you can specify a type per bound name.
>
>However, I don't think implicit conversions would be appropriate here, so
>the rules would be different from a variable in the sense that you would
>always need to specify the type exactly. That also makes this whole thing a
>bit less powerful and useful though.
Maybe you could specify a concept per element.
auto [same_as<int> x, same_as<double> y] = ...
>
>On Sat, May 11, 2024, 08:59 Oliver Schädlich via Std-Proposals <
>std-proposals_at_[hidden]> wrote:
>
>> 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;
>>
>>
>>
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>The proposed syntax is a bit misleading because the type is still a
>std::pair, not an int. Something like what Tiago wrote would make sense,
>where you can specify a type per bound name.
>
>However, I don't think implicit conversions would be appropriate here, so
>the rules would be different from a variable in the sense that you would
>always need to specify the type exactly. That also makes this whole thing a
>bit less powerful and useful though.
Maybe you could specify a concept per element.
auto [same_as<int> x, same_as<double> y] = ...
>
>On Sat, May 11, 2024, 08:59 Oliver Schädlich via Std-Proposals <
>std-proposals_at_[hidden]> wrote:
>
>> 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;
>>
>>
>>
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
Received on 2024-05-12 09:16:58