Passing aligned types or structures with aligned types by value doesn\'t work with some implementations. This breaks STL containers, because some of the methods (such as resize)
I think the only safe way to do this in general is to pass by reference. Some platforms (e.g. Xbox 360) support passing vector arguments in registers, but I don't think this is possible on x86.
For the std::vector
case, you'll need to make sure that the memory allocated is aligned to 16 bytes; otherwise you'll get crashes when you try to perform most operations on unaligned vectors.
If you're supporting multiple platforms, a safe plan is to use a typedef
e.g.
typedef const MyVector& MyVectorParameter;
You can then change the typedef on platforms that support vector pass-by-value.
the oftenly used resize() function is causing all the alignment and perhaps you can try to specialise vector template for __m128 ?