In C++26, this runs inside the compiler:
try { template_of(r); }
catch (std::meta::exception& e) { ... }
Reflection errors are real exceptions. You can catch them at compile time 🧵👇
static_assert(std::is_trivial_v<T>);
C++26 deprecates this
"Trivial" bundles two different questions: can I memcpy it, and can I skip constructing it. Most code only cares about one
Good riddance, or one more migration chore? 🧵👇
std::optional<int> o;
On a freestanding build (no OS, think microcontroller), <optional> wasn't guaranteed to exist. Neither was std::array or std::string_view
C++26 fixes the embedded subset 🧵👇
constexpr auto r = ^^int;
That's the C++26 reflection operator. Two carets
One caret was the plan. It collided with Clang's blocks extension, where ^{ ... } already means something
Love it or hate it? 🧵👇
std::shared_ptr<Config> cfg;
auto c = std::atomic_load(&cfg);
The C++11 way to share a shared_ptr across threads. Nothing stopped someone else from touching cfg without the atomic call
C++26 deletes it 🧵👇