When is reinterpret_cast UB?
Does the code below contains UB?
struct A
{
int x;
char y;
};
int main()
{
std::vector v(sizeof(A), 0);
A* p = reinterpret_cast(v.data());
p->x = 1;
p->y = 'a';
std::cout << p->x << " " << p->y << std::endl;
}
should I use std::launder?