queues icon indicating copy to clipboard operation
queues copied to clipboard

mpsc-queue.hpp has issue

Open X-Ryl669 opened this issue 10 years ago • 0 comments

When using std::aligned_storage, you must explicitly call constructor and destructors on the "reinterpreted_cast"'d object (with placement new, and explicit output->~T() call).

In all case, std::aligned_storage is not required in this file, since the compiler will ensure that the structure is correctly aligned anyway. By default, unless you pragma pack your structure (which is not the case here), the compiler will ensure the structure is aligned with respect to its largest field's alignment requirement, and that's exactly what you get with the std::aligned_storage code that's written.

X-Ryl669 avatar Nov 04 '15 18:11 X-Ryl669