Can the storage of trivially copyable objects be safely reallocated with realloc?
问题 I know that trivially copyable objects can safely be copied my malloc into an appropriate storage location 1 and that the destination object will have the same value as the source. Is this also possible with realloc ? That is, if realloc some storage containing some objects of type T , and realloc decides to move and copy the block, will the objects in the newly allocated storage be intact and have started their lifetime, and will the lifetime of the objects in the old storage be safely ended