...
In this compliant solution, std::uninitialized_copy()
is used to perform the copy, instead of std::copy()
, ensuring that the objects are initialized using placement new
instead new instead of dereferencing uninitialized memory. Identical code from the noncompliant code example has been elided for brevity.
...