TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C++26: Pack Indexing

60 pointsby HeliumHydride4 months ago

9 comments

suby4 months ago
I don't have a source, but I have read that the reason this wasn't originally introduced into C++ was because they couldn't agree on what the syntax would be. So much pain because the committee is dysfunctional, it took a decade plus to introduce something that everyone from the start wanted and understood would improve things. Par for the course with C++.
评论 #42817073 未加载
评论 #42817466 未加载
评论 #42817197 未加载
a_t484 months ago
I usually find myself putting parameter packs into tuples and then using `std::get` on the tuple to index. It's not perfect (will end up making copies), but has the side benefit of being able to additionally store the parameter pack for later.
foota4 months ago
This is nice, but I'm still waiting for a constexpr for loop to use it with.
评论 #42816640 未加载
评论 #42817930 未加载
评论 #42817108 未加载
评论 #42816724 未加载
评论 #42816379 未加载
评论 #42816361 未加载
binary1324 months ago
The griping in the comments here is insane considering that being able to easily static_assert(first(1, 2, 3, 4, 5) == 1) is a pretty powerful language feature.
int_19h4 months ago
Zig's approach to generics and metaprogramming - treating functions and types as first-class compile-time values in the base language - makes more and more sense.
psyclobe4 months ago
C++ parameter packs are really bad ass, super cool to see this added
rurban4 months ago
More insane... syntax from the C++ committee. How about a readable function-like keyword, like any other self-respecting language? C++ surpassed APL and Perl by far already. Really, in APL there is some consistency at least.
评论 #42818135 未加载
评论 #42818036 未加载
edflsafoiewq4 months ago
C++ continues its long journey to making its template system an actual usable programming language.
评论 #42816645 未加载
评论 #42817166 未加载
评论 #42817399 未加载
评论 #42816445 未加载
评论 #42820041 未加载
coolThingsFirst4 months ago
lol<p>C with STL would&#x27;ve saved the world a lot of trouble.
评论 #42820027 未加载