Category "placement-new"

Calling `std::vector<A>::data()` on `A` with const or reference fields, before C++20

This is a followup on the answers for placement new on a class with reference field. Calling std::vector<A>::data() on type A that has reference or const

Is placement new on a const variable with automatic storage duration legal? [duplicate]

Is the following code legal according to the standard? #include <new> int main() { const int x = 3; new ((void *)&x) int { 1

I try to use placement new, but always complies error

#include <iostream> #include <new> const int BUF = 512; const int N = 5; char buffer[BUF]; int main(){ using n