<html><head></head><body lang="en-US" style="background-color: rgb(255, 255, 255); line-height: initial;"> <div style="width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);">Can you show an example of use?</div> <div style="width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);"><br style="display:initial"></div> <div style="font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);">Sent from my BlackBerry portable Babbage Device</div> <table width="100%" style="background-color:white;border-spacing:0px;"> <tbody><tr><td colspan="2" style="font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"> <div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in; font-family: Tahoma, 'BB Alpha Sans', 'Slate Pro'; font-size: 10pt;"> <div><b>From: </b>Andrey Davydov</div><div><b>Sent: </b>Thursday, October 11, 2018 3:05 PM</div><div><b>To: </b>ISO C++ Standard - Future Proposals</div><div><b>Reply To: </b>std-***@isocpp.org</div><div><b>Subject: </b>[std-proposals] std::type_pack_element</div></div></td></tr></tbody></table><div style="border-style: solid none none; border-top-color: rgb(186, 188, 209); border-top-width: 1pt; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"></div><br><div id="_originalContent" style=""><div dir="ltr"><span style="font-size: small;">It's often needed to index into template parameter pack, when working with variadic templates, for instance in implementation of <font face="courier new, monospace">std::get<size_t></font> of <font face="courier new, monospace">tuple</font> and <font face="courier new, monospace">variant</font>. I wonder if there is any proposal to add metafunction </span><div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #008;" class="styled-by-prettify"><std::size_t</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #606;" class="styled-by-prettify">I</span><span style="color: #000;" class="styled-by-prettify">, </span><span style="color: #606;" class="styled-by-prettify">typename</span><span style="color: #000;" class="styled-by-prettify"> ...</span><span style="color: #606;" class="styled-by-prettify">Ts</span><span style="color: #008;" class="styled-by-prettify">></span><span style="color: #000;" class="styled-by-prettify"><br>using type_pack_element = ...<br></span></div></code></div><div><span style="font-size: small;">It</span><span style="font-size: small;"> </span><span style="font-size: small;">can be implemented using existing language facilities or, similarly to <font face="courier new, monospace">std::make_integer_sequence</font>, using compiler intrinsic. It's already implemented in Clang (<font face="courier new, monospace">__type_pack_element</font>), and IMO it should not be hard to support in other compilers. Moreover it should be much more efficient from compile-time perspective because variadic pack is stored in some vector-like data structure, and consequently to get element by index from it is much cheaper than class template instantiation, overload resolution, etc...</span></div></div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:std-proposals+***@isocpp.org">std-proposals+***@isocpp.org</a>.<br>
To post to this group, send email to <a href="mailto:std-***@isocpp.org">std-***@isocpp.org</a>.<br>
To view this discussion on the web visit <a href="https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f2d44cc1-d626-4adb-9f4c-b4555ee4cb08%40isocpp.org?utm_medium=email&utm_source=footer">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f2d44cc1-d626-4adb-9f4c-b4555ee4cb08%40isocpp.org</a>.<br>
<br><!--end of _originalContent --></div></body></html>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:std-proposals+***@isocpp.org">std-proposals+***@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-***@isocpp.org">std-***@isocpp.org</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/20181011193012.5218385.29683.63037%40gmail.com?utm_medium=email&utm_source=footer">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/20181011193012.5218385.29683.63037%40gmail.com</a>.<br />