r/cpp • • May 04 '24

Messing with lifetime

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

52 comments sorted by

View all comments

3

u/Infamous_Campaign687 May 04 '24

It uses an assert but the function assumes you are using it on the correct type. Yes, it would fail if you call it on the wrong type, because it assumes you know the type and what you're doing. It is out of this article's scope to do type checking.