How C++20 Can Simplify std::tuple
summary
C++20 lets a std::tuple implementation shrink from piles of SFINAE and 18 special constructors to nearly an aggregate: Concepts-based tuple_like constraint replaces fragile enable_if hacks, fold/expansion statements plus templated lambdas implement elementwise operator==, swap and operator< concisely, and no_unique_address empty storage plus aggregate parentheses remove most inheritance work. The result is an optimized, high-performance tuple built almost as a plain struct that compiles and in examples behaves correctly; allocator-aware constructors remain a loose corner case.
AI-written summary · about
chapters (31)
- 0:00Intro
- 1:53C++20 Big Ticket Items
- 3:24Modules...
- 4:29Outline of a Module
- 6:10Module Preamble
- 7:25Naming emphasizes structure
- 8:56Why is get not a member?
- 14:11C++17 tuple Enhancments
- 15:54C++17 Language Features
- 16:58Fold Expressions (C++17)
- 17:31Fold Expression Grammar
- 19:42Generic Implementation
- 20:28Implementing comparison in C++17
- 21:21Basic Implementation
- 23:17SFINAE constraints
- 26:47Perform comparison
- 27:50Implementing comparison in C++20
- 31:17The TupleLike Concept
- 39:44swap using lambda in C++20
- 42:00swap using expansion statement in C++20
- 43:18Expansion Statements
- 44:22Support Structured Binding
- 45:29Implementing operators in
- 47:26with expansion statement
- 48:11Final Rendering with the Spaceship Operator
- 52:06What Can Spaceship Return?
- 54:13Implementation Strategy 1
- 55:01Basic Model
- 56:29Implementing get
- 57:06Ideal Version of wrap
- 57:19Issues with wrap
related talks
01h 01mtuple<>: What's New and How it Works
51mA Tale of Two Tuples - A Story of the C++ Revolution
05mC++20 Lambdas: Familiar Template Syntax
01h 10mBack to Basics: Algebraic Data Types
01h 03mC++20: The small things
05mImprove Compile Time With One Weird Trick Template Meta Programmers Hate!
51mModern techniques for keeping your code dry
01h 21mWhat Has C++20 Ever Done For Templates?
