Constexpr and operator overloading: Why everything is terrible
summary
Implements an optional backport for C++11 that breaks when stored T overloads operator&; using plain & on unioned storage triggers wrong codegen. std::addressof lacks a constexpr const overload in C++11 so the easy fix doesn't compile. Reinterpret_cast of the dummy is non-constexpr, static_cast-from-dummy hits the void-cast bug, and the array+decay trick fails because emplacement requires direct construction. Final choice is to use address-of and drop constexpr for now, a pragmatic tradeoff.
AI-written summary · about
chapters (7)
- 0:00Intro
- 0:15Background information
- 0:47Operator Arrow
- 1:05Operator ref
- 1:55Casting
- 2:25Handsdown
- 2:35Solution
related talks
01h 05mC++ Lambda Idioms
01h 03mEmbracing User Defined Literals Safely for Types that Behave as though Built-in
01h 01mWhy does std::format do that?
01h 01mCalling Functions
27mThe Life of a JavaScript Feature in V8 ft. TypedArrays
24mDemystifying V8 and JavaScript Performance
06mLightning Talk: The Decade Long Rewind: Lambdas in C++
20mJavaScript’s “+” Operator and Decision Fatigue
