Is it OK to discard placement new return value when initializing objects
问题 This question originates from the comment section in this thread, and has also got an answer there. However, I think it is too important to be left in the comment section only. So I made this Q&A for it. Placement new can be used to initialize objects at allocated storage, e.g., using vec_t = std::vector<int>; auto p = (vec_t*)operator new(sizeof(vec_t)); new(p) vec_t{1, 2, 3}; // initialize a vec_t at p According to cppref, Placement new If placement_params are provided, they are passed to