Date: Sat, 23 May 2026 10:44:20 +0200
See here, why break N is a bad idea.
The same applies to %%
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3568r0.html
-----Ursprüngliche Nachricht-----
Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Sa 23.05.2026 10:23
Betreff:Re: [std-proposals] return value lives until end of scope
An:std-proposals_at_[hidden];
CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>;
On Saturday, May 23, 2026, Sebastian Wittmeier wrote:
You can use a single variable (container for futures) and use it as reference parameter to a function creating your async call.
I think the following:
int main()
{
for ( unsigned i = 0u; i < N; ++i )
{
%%async(Func);
}
}
would have to be implemented by the compiler something like:
int main()
{
struct Frame {
alignas(std::future<int>) char unsigned f[ sizeof(std::future<int>) ];
Frame *next;
};
Frame fr;
Frame *p = &fr;
for ( unsigned i = 0u; i < N; ++i )
{
::new(p->f) std::future<int>{ async(Func) };
p->next = alloca( sizeof *p );
p->next.next = nullptr;
p = p->next;
}
for ( p = &fr; nullptr != p; p = p->next )
{
((std::future<int>*)p->f)->~std::future<int>();
}
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2026-05-23 08:47:06
