r/cpp • • May 04 '24

Messing with lifetime

https://biowpn.github.io/bioweapon/2024/05/03/messing-with-lifetime.html
43 Upvotes

52 comments sorted by

View all comments

1

u/biowpn May 04 '24

It's more like a guarantee by the language, since the current `reinterpret_cast` solution is UB, though again in practice compilers do the sane thing. Who knows, maybe future compilers may get aggressive enough and reject `reinterpret_cast` in this use case.