Sunday, December 25, 2011

Microsoft's vector and alignment

Can't use Microsoft's implementation of vector with aligned data, all because of one line.

void resize(size_type _Newsize, _Ty _Val)

Change it to

void resize(size_type _Newsize, const _Ty& _Val)

And everything works.  But is hacking my STL files a good idea or should I use some other version of vector just for aligned data?

The standard was updated recently and indicates that 2nd version is now the correct way, so I believe this will be fixed eventually, probably the next edition of Visual C++, ah well-- I'll just hack it for now..

-edit(9/28/2013): this is no longer an issue in Visual Studio 2013, it works out of the box