Are You Structure Bindable? A Tour via Concepts, SFINAE & Herb Sutter's Pattern Matching
summary
Builds a working structure_bindable concept that detects tuplelike, pair, and array bindings and—using Herb Sutter’s p2392r1 pattern matching and a size_of-on-pack proposal—also recognizes user-defined structs by arity. Shows failed attempts (concept bodies cannot perform bindings, SFINAE-only solutions require compiler intrinsics), then prototypes a real solution on the Circle compiler with static_asserts and constrained overloads that dispatch by exact number of bound elements. Demonstrates runnable examples and explains which approaches compile portably and which need nonstandard extensions.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 2:20Structure Binding
- 4:25Create Your Own Type
- 6:15C Style Arrays
- 7:20Creating a Concept
- 17:00Intrinsic Features
- 19:03Pattern Matching
- 25:32Single Element Structure Bindable
- 27:49Two Element Structure Bindable
- 30:37Anything
- 32:52Structure Bindable with Two
- 37:42Resources
related talks
01h 30mRethinking the Way We Do Templates in C++
01h 03mPattern Matching: A Sneak Peek
07mPattern Matching in C++14
06mConstraints not Satisfied
01h 02mDiscovering a User-Facing Concept
01h 07mDesign Patterns in Modern C++
01h 28mC++ Concepts "Lite" in Practice
01h 11mConcepts in 60: Everything you need to know and nothing you don't
