Date: Wed, 31 Jul 2024 09:03:04 -0700
On Wednesday 31 July 2024 03:53:06 GMT-7 Breno GuimarĂ£es via Std-Proposals
wrote:
> for(const aut& elem: vec)
> {
> auto r = elem(0);
> }
>
> Suppose you managed to make the operator() work and return different types
> depending on the value of "elem".
> What size of stack should be allocated for r? What destructor should be
> called for "r"?
This is the same as a std::variant whose template parameters are filled in by
the compiler. The one line in the loop is basically a very large switch block
or a visit:
elem.vsiit([](auto &realelem) { auto r = realelem(0); });
wrote:
> for(const aut& elem: vec)
> {
> auto r = elem(0);
> }
>
> Suppose you managed to make the operator() work and return different types
> depending on the value of "elem".
> What size of stack should be allocated for r? What destructor should be
> called for "r"?
This is the same as a std::variant whose template parameters are filled in by
the compiler. The one line in the loop is basically a very large switch block
or a visit:
elem.vsiit([](auto &realelem) { auto r = realelem(0); });
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel DCAI Platform & System Engineering
Received on 2024-07-31 16:03:08