Nth pack element... - A case study
summary
Varied C++ techniques for extracting the nth element are implemented and benchmarked (recursion, overloads, fold/IVFE, C++20 concepts, mp11, preprocessor generation, Clang/Circle extensions, proposed p1858). The measurement uses metabench across GCC 12 and Clang 15 and shows recursion is slow, concept/expansion and mp11 compile fast for moderate sizes, preprocessor hits limits, and Circle is flat and dominates large packs. Code and slides are provided and the benchmarks consistently favor compiler-level or language-feature solutions.
AI-written summary · about
chapters (26)
- 0:00Talk overview
- 1:42Nth element motivation
- 5:35Current C++ tuple access
- 10:30Future C++ proposals
- 13:26Nth element requirements
- 16:55Recursive nth element
- 21:33Recursive with concepts
- 25:09Immediately invoked function expression
- 28:41Concept-based expansion
- 31:53MP11 library solution
- 35:30Preprocessor solution
- 39:50Anonymous struct inheritance
- 42:02Circle extension
- 43:49Circle compiler
- 45:15P1858 proposal
- 46:22Nth element in std::tuple
- 47:30Zero-based tuple access
- 48:32Circle vs std::tuple
- 49:14Tuple with C++20 ranges
- 51:03Benchmark compilation
- 53:10Benchmark small tuples
- 53:55Benchmark large tuples
- 55:23Circle vs compilers
- 57:10Compiler comparison
- 58:12Performance languages
- 59:14Recommendations outlook
related talks
55mBack to Basics: Algorithmic Complexity
01h 00mBack to Basics: (Range) Algorithms in C++
56mThrowing Tools at Ranges
57mHow to Design a Slimmer Vector of Variants in C++
01h 02mBreaking Dependencies - The Visitor Design Pattern in Cpp
01h 06mConquering C++20 Ranges
06mLightning Talk: Cute Approach for Polymorphism in C++
01h 05mBetter C++ ranges
