...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <new> #include <stdlib.h> struct alignas (32) Vector { char elems [32]; static void* operator new (size_t); static void operator delete (void *p) { free (p); } }; void* Vector::operator new (size_t nbytes) { if (void *p = aligned_alloc (32alignof (Vector), nbytes)) return p; throw std::bad_alloc (); } Vector* f() { Vector *pv = new Vector (); return pv; } |
...