Date: Tue, 7 Apr 2026 14:00:26 +0200
On Tue, Apr 7, 2026 at 10:58 AM Muneem via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> You may disagree for the need of T^ but again considering that
> heterogeneous lists will mostly be ever used in networking protocols,
> JSONs, XMLs, you want as the programmer to have a freehand in providing
> (application) safety, when you let a user index your list with any index he
> wants.
>
JSON and XML where the examples I have provided before. However, these only
work if we have a runtime heterogeneous list. Until now (especially with
your example from the Turing virtual machine) we were talking about
heterogeneous lists known at compile time. The solutions to these problems
differ a lot: at compile time we can just use std::tuple. However, if we
want to modify a list at runtime we are back to std::vector<std::variant>
(or something similar). With your most recent explanations we are closer to
the latter. However, the most efficient solution in your case would work
with a std::tuple rather than with a std::vector<std::variant>. If the
types are fixed at compile time the compiler can optimize much better.
So, which one do you want? Compile time lists or runtime lists? (Runtime
indices would be allowed in both cases.)
std-proposals_at_[hidden]> wrote:
> You may disagree for the need of T^ but again considering that
> heterogeneous lists will mostly be ever used in networking protocols,
> JSONs, XMLs, you want as the programmer to have a freehand in providing
> (application) safety, when you let a user index your list with any index he
> wants.
>
JSON and XML where the examples I have provided before. However, these only
work if we have a runtime heterogeneous list. Until now (especially with
your example from the Turing virtual machine) we were talking about
heterogeneous lists known at compile time. The solutions to these problems
differ a lot: at compile time we can just use std::tuple. However, if we
want to modify a list at runtime we are back to std::vector<std::variant>
(or something similar). With your most recent explanations we are closer to
the latter. However, the most efficient solution in your case would work
with a std::tuple rather than with a std::vector<std::variant>. If the
types are fixed at compile time the compiler can optimize much better.
So, which one do you want? Compile time lists or runtime lists? (Runtime
indices would be allowed in both cases.)
Received on 2026-04-07 12:01:09
