Talk:More C++ Idioms/Generic Container Idioms

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

[edit] Alignment issues on sample

array_ (static_cast <T *>(::operator new (sizeof (T) * size))), // T need not support default construction

Doesn't this code have alignment issues? ::operator new is not guaranteed to align memory properly for any given type, while the type's new is. Is there a portable idiom to do this correctly?