Skip to content

Instantly share code, notes, and snippets.

@njlr
Created September 19, 2017 11:38
Show Gist options
  • Save njlr/d78339cb588f84ff5141e192389890ca to your computer and use it in GitHub Desktop.
Save njlr/d78339cb588f84ff5141e192389890ca to your computer and use it in GitHub Desktop.
char memorypool[64];
int* a = new (memorypool) int[4];
int* b = new (memorypool + sizeof(int) * 4) int[4];
assert( (void*)a[0] == (void*)memorypool[0] );
assert( (void*)b[0] == (void*)memorypool[32] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment