Date: Wed, 4 Feb 2026 17:02:49 +0300
It's pretty weird. IMO, the simpler case for non-expert usage does not
work. But, thank you, now I know what to do.
template for (auto _ : {0}) {
auto &&[...elems] = ::std::move(tuple);
use(::std::move(elems)...);
}
ср, 4 февр. 2026 г. в 16:12, Brian Bi <bbi5291_at_[hidden]>:
> The body of an expansion statement is treated as if it's part of a
> template (e.g. you have to put `typename` in various places). If a
> structured binding pack could appear outside a template, it would force the
> entire remainder of the current scope to be treated as a template.
>
> On Wed, Feb 4, 2026 at 8:05 AM Артём Колпаков via Std-Discussion <
> std-discussion_at_[hidden]> wrote:
>
>> Good afternoon. Why can't the structured binding pack be used outside of
>> the template, whereas the expansion statement can. It seems to me that for
>> tuple-like types there is no significant difference between these language
>> features, but to use the first one, you have to use a synthetic template
>> where there is no real one. Is this a language defect?
>>
>> I'm not sure what the documents say about this. I am writing immediately
>> after observing the error on goldbolt.
>>
>> Thank you for your attention.
>> Artyom Kolpakov
>> --
>> Std-Discussion mailing list
>> Std-Discussion_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>>
>
>
> --
> *Brian Bi*
>
work. But, thank you, now I know what to do.
template for (auto _ : {0}) {
auto &&[...elems] = ::std::move(tuple);
use(::std::move(elems)...);
}
ср, 4 февр. 2026 г. в 16:12, Brian Bi <bbi5291_at_[hidden]>:
> The body of an expansion statement is treated as if it's part of a
> template (e.g. you have to put `typename` in various places). If a
> structured binding pack could appear outside a template, it would force the
> entire remainder of the current scope to be treated as a template.
>
> On Wed, Feb 4, 2026 at 8:05 AM Артём Колпаков via Std-Discussion <
> std-discussion_at_[hidden]> wrote:
>
>> Good afternoon. Why can't the structured binding pack be used outside of
>> the template, whereas the expansion statement can. It seems to me that for
>> tuple-like types there is no significant difference between these language
>> features, but to use the first one, you have to use a synthetic template
>> where there is no real one. Is this a language defect?
>>
>> I'm not sure what the documents say about this. I am writing immediately
>> after observing the error on goldbolt.
>>
>> Thank you for your attention.
>> Artyom Kolpakov
>> --
>> Std-Discussion mailing list
>> Std-Discussion_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>>
>
>
> --
> *Brian Bi*
>
Received on 2026-02-04 14:03:08
