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 🧵👇
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
- 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
- const std::string& get() { return "oops"; // dangling reference } This compiles in C++23. The temporary string is destroyed, the reference dangles, and you get undefined behavior at runtime C++26 makes it a compile time error 🧵👇

