C++17 introduced std::launder, and C++23 introduced std::start_lifetime_as, so it seems the Standards guys are really taking the 'object model' seriously.
Amidst all this seriousness though, those two functions are no-op's for most compilers.
Enthusiasts tried to find a situation in which std::launder actually does something, and they only found one example of C++ code that behaves
differently when you use 'launder', and it involved a constructor using
'placement new' to invoke a constructor belonging to another class on the
current object, something like:
MyClass::MyClass(void)
{
::new(this) SomeOtherClass();
}
The use of 'launder' on the pointer to this object prevented caching of the vtable, you can see what they did here:
https://miyuki.github.io/2016/10/21/std-launder.html
I achieved something similar by marking the object as 'volatile' in a puzzle I composed on Codewars:
https://www.codewars.com/kata/6359c81e00fba2852618a1cb/
I've been mulling over the idea though of using 'placement new' inside a class's constructor in order to change its vtable. Can anyone think of any weird, wild and wacky uses of this?