cpp_weekly icon indicating copy to clipboard operation
cpp_weekly copied to clipboard

no more new! construct_at

Open lefticus opened this issue 2 months ago • 1 comments

using construct_at instead of placement new: https://cppreference.net/cpp/memory/ranges/construct_at.html

lefticus avatar Nov 03 '25 19:11 lefticus

Unfortunately it breaks RVO and in-place construction because it has to move the arguments, so raw placement new still has to be used in some cases. Perhaps that is why there is still momentum to make raw placement new allowed in constexpr.

LB-- avatar Nov 03 '25 21:11 LB--