C++26 introduces `std::is_within_lifetime(const T* p)` in the `<type_traits>` header, a consteval-only function that checks whether a pointer points to an object currently within its lifetime during constant evaluation. Its primary use case is determining which member of a union is active at compile time. The motivation came

5m read timeFrom sandordargo.com
Post cover image
Table of contents
What does std::is_within_lifetime do?Properties and the nameThe original motivationCompiler supportConclusionConnect deeper

Sort: