DP
Я правильно понимаю, что
std::launder
позволяет обойти UB из примера выше?int a = 5;
int *p = &a;
double *d = std::launder(reinterpret_cast<double*>(p));
Конечно, если int и double каким-то чудом имеют одинаковый размер
Size: a a a
DP
std::launder
позволяет обойти UB из примера выше?int a = 5;
int *p = &a;
double *d = std::launder(reinterpret_cast<double*>(p));
CD
LA
CD
ID
CD
CD
CD
CD
ID
CD
CD
Ж
CD
ID
if you allocate a new object in the storage of the old one, you cannot access the new object through pointers to the old
Ж
CD
if you allocate a new object in the storage of the old one, you cannot access the new object through pointers to the old
ID
NM
ID
std::exception