How can shared_ptr disrupt alignment
std::shared_ptr doesn't affect alignment. It just takes in a pointer to an already allocated object, so if that allocation resulted in a misaligned object, the problem isn't with
std::shared_ptr, it's with that allocation.
std::shared_ptr is often used with
std::make_shared<T> performs a single allocation to reserve memory both for the
std::shared_ptr control structure and the
T instance. This allocation isn't done using any class-specific
operator new (and shouldn't be). If the class-specific
operator new sets up stricter alignment than what the default allocator does, then it's easy to see how this can fail when the default allocator gets used.