Is there a way to enforce STL container alignment to specific byte, using attribute((aligned))perhaps? the target compilers are not Microsoft Visual C++.
What libraries, if any, provide specialized templates of STL algorithms which have specific explicit vectorization, e.g. SSE. My compilers of interest are g++, Intel, and IBM XL.
With STL containers, you can provide your own allocator via an optional template parameter. I wouldn’t recommend writing an entire allocator from scratch, but you could write one that’s just a wrapper around
newanddeletebut ensures that the returned memory meets your alignment requirement. (E.g., if you neednbytes with 16-byte alignment, you usenewto allocaten + 15bytes and return a pointer to the first 16-byte aligned address in that block.)But it might be enough just to add the alignment attribute to the element type. That’s outside the scope of the standard, so you’d have to check your compiler documentation and try it.