In Windows (I am unsure of other platforms) New will always align only on a boundry of the largest type, ie 8 bytes for 32 bit platforms, no matter what you do to it. It all falls down to the win32 HeapAlloc function, so you can use malloc with placment new -- I think thats what it is called -- example:
void *pointer = malloc(sizeof(EMatrix)+16);EMatrix *matrix = new((pointer+16)&(~15)) EMatrix;// Should most likely only free pointermatrix->~EMatrix();free(pointer);
I also can't recall what it is named but there is a version of malloc that will align for you, but it does this exact same thing inside. -- EDIT: _aligned_malloc() thats what it was songho reminded me.
Of course you could do the same thing with just allocating two EMatrix classes with new and move the pointer the same way, although that will really F your destruction, etc, So i recommend against it.
Anycase sorry for the bad news that alignment stuff is so missleading in the documentation. It only guarantees that the structure will align to 16 bytes within the class, so once you throw new at it everything is out the window.
[Edited by - Wolfdog on September 18, 2007 10:23:20 AM]