I'm a bit confused about the alignement requirements when std::aligned_storage is used and dynamic allocation is needed. Example:
using storage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type;
storage* pool;
pool = ::new storage[num_obj];
Is it legal? The new operator doesn't return alignment memory, so is the result correct?
Aucun commentaire:
Enregistrer un commentaire