<div dir="ltr">1. I am not stating that book keeping is obligatory, but rather the implementation has that choice to make, and as we know the implementation knows more than us.<div>2. the layout can change based on a standard tag : std::tuple&lt;T..., std::runtime_index_tag&gt; or std::tuple&lt;std::runtime_index_tag, T...&gt;, this is because the std namespace is reserved for the standard library, so you yeah, if anyone were to defined std::runtime_index_tag and then use  std::tuple&lt;std::runtime_index_tag, T...&gt;, he would effectively turn his program into a ill formed program. read this <a href="https://en.cppreference.com/cpp/language/extending_std">https://en.cppreference.com/cpp/language/extending_std</a> for a more trustworthy source on why the std namespace is reserved.</div><div>3.Again, having bookkeeping information in the tuple is completely optional for the implementation based on what it thinks is most efficient for runtime indexing.</div><div>4. while allowing runtime indexing, all the user should care about is a stable non changing interface or not because believe me or not, I thought that using pointers is actually efficient as it can help me save space(4 years ago), and that may or not be right, so what I would rather want is the implementation to handle that for me. Runtime indexing is something that should not be related with space or time constraints but rather be a nice balance between them.</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Apr 17, 2026 at 6:24 PM Jason McKesson via Std-Proposals &lt;<a href="mailto:std-proposals@lists.isocpp.org">std-proposals@lists.isocpp.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, Apr 17, 2026 at 4:52 AM Muneem via Std-Proposals<br>
&lt;<a href="mailto:std-proposals@lists.isocpp.org" target="_blank">std-proposals@lists.isocpp.org</a>&gt; wrote:<br>
&gt;<br>
&gt; The bookkeeping for example could be initializing a std:: variant&lt;T&amp;...&gt; For every T in the T... Passed to the tuple as a template argument, and storing them in an array. The subscript would simply index and return any of them.<br>
<br>
Here&#39;s the problem. Doing what you propose is equivalent of defining a<br>
struct where every member also has a second member that is a pointer<br>
to that element. That represents a memory vs. performance tradeoff:<br>
you&#39;re bloating the data layout of the runtime tuple in exchange for<br>
reducing the cost of getting the variant (in theory; I genuinely don&#39;t<br>
believe this would ever be a performance problem in practice, but<br>
let&#39;s pretend).<br>
<br>
The bigger problem with this is that how much of an overall<br>
performance boost this gives is *not* something that a compiler could<br>
ever optimize for. For one thing, the data layout cannot be changed;<br>
whether it has these internal pointer or not is a part of the class<br>
itself. For any given `runtime_tuple&lt;Ts...&gt;`, it will either always<br>
have internal pointers or it always won&#39;t. That&#39;s baked into the<br>
implementation and its chosen data layout.<br>
<br>
But whether those internal pointers are worth the bloat depends on the<br>
access pattern of the object. That is, how much you use runtime<br>
indexing vs. copying/storage/cache misses/etc. The compiler *cannot*<br>
know that because it&#39;s ultimately based on information compilers<br>
cannot have.<br>
<br>
Put simply, whether `runtime_tuple&lt;int, float&gt;` should be 24 bytes<br>
instead of 8 bytes depends entirely on the how a particular user uses<br>
it. One user might not index enough to make the extra 16 bytes of<br>
storage worth having, while the other person might. This decision must<br>
be made by the user; it cannot be made by the compiler, since the<br>
compiler must pick one or the other at instantiation time.<br>
<br>
So if the performance issue you&#39;re talking about actually exists,<br>
you&#39;d need two types to allow the user to pick whichever is higher<br>
performance for their use case at that time.<br>
-- <br>
Std-Proposals mailing list<br>
<a href="mailto:Std-Proposals@lists.isocpp.org" target="_blank">Std-Proposals@lists.isocpp.org</a><br>
<a href="https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals" rel="noreferrer" target="_blank">https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals</a><br>
</blockquote></div>

