constexpr auto [x, y] = std::pair{1, 2}; // error in C++23
You can constexpr a pair. You can structured bind a pair. But you can't do both at the same time
C++26 removes the restriction 🧵👇
Our mission is to make the C++ programming language accessible and useful to anyone who wishes to learn and apply the language.
Joined November 2017
- constexpr auto x = std::sqrt(2.0); // error in C++23 You can do compile time integer math. You can do compile time string processing. But std::sqrt, std::sin, std::pow? "Not a constant expression" C++26 makes nearly all of <cmath> constexpr 🧵👇
- vector, array, string, string_view, deque. Every contiguous container gives you .at() for bounds checked access span? No .at(). Just operator[] and hope you indexed right C++26 finally fixes it 🧵👇
- std::visit(overloaded{ [](int i) { ... }, [](std::string s) { ... } }, v); The variant goes at the end, the visitor goes first. It reads inside out C++26 flips it: v.visit(...)
- Three vectors. You want to iterate over all of them as one sequence C++23 ranges: copy everything into a new container, or write three separate loops C++26: views::concat(v1, v2, v3) — zero copies, one range

