Why introduce `std::launder` rather than have the compiler take care of it?
问题 I've just read What is the purpose of std::launder? and frankly, I am left scratching my head. Let's start with the second example in @NicolBolas' accepted answer: aligned_storage<sizeof(int), alignof(int)>::type data; new(&data) int; int *p = std::launder(reinterpret_cast<int*>(&data)); [basic.life]/8 tells us that, if you allocate a new object in the storage of the old one, you cannot access the new object through pointers to the old. std::launder allows us to side-step that. So, why not