4 ms·
I believe you are talking about *ptr = T(std::forward<Args>(args)...) That's an rvalue ref so std::move is superfluous. Not an assign
by _4r6j 5y ago
I believe you are talking about
*ptr = T(std::forward<Args>(args)...)
That's an rvalue ref so std::move is superfluous. Not an assign
- Matheus28 5y agoThis is how it's being done in one of the places: new (ptr) T; // default-initialization of T *ptr = T(std::forward<Args>(args)...); // Constructs a new T, then calls operator=(T&&) on ptr, then destroys the T that got moved I meant he should do the placement new like this: new (ptr) T(std::forward<Args>(args)...) // Constructs directly on ptr See https://godbolt.org/z/9nT94zxoE https://godbolt.org/z/9nT94zxoE