C++ Logo

std-proposals

Advanced search

Re: [std-proposals] [std-proposa

From: organicoman <organicoman_at_[hidden]>
Date: Thu, 01 Aug 2024 01:46:02 +0400
Sent from my Galaxy
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); });Hello Thiago,Although in my example i didn't write:auto r = elem(0);But i wroteActBasedOnType(elem(0));With ActBasedOnType defined as a function template.But yes indeed, your explanation is correct.Since in C++ there is no way to generate types on the fly, the set of types in any translation unit is well know and fixed. That's an attribute useful to reason about manipulating a set of type at compile time then discard that manipulation.Much like SQL query planner, it has to prove what should be selected and what should be discard, before even executing the statement.

Received on 2024-07-31 21:46:12