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 wrote
ActBasedOnType(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.