Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
struct empty_struct {};
struct dummy_type {
static_assert(sizeof(T) % sizeof(empty_struct) == 0, "");
// Use an array to avoid GCC 6 placement-new warning.
empty_struct data[sizeof(T) / sizeof(empty_struct)];
// Data storage
union {
T data_;
dummy_type dummy_;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment