I am trying to save an SSE type in a stl container. I tried this:
#include <iostream> #include <vector> int main() { typedef int v4sf __attribute__ (( vector_size(4*sizeof(float)) )); v4sf a; // compiles std::vector<v4sf> v1; // compiles, but nothing is actually allocated // std::vector<v4sf> v2(10); // compiler error: can't convert between vector values of different size std::vector<v4sf> v(10, a); // Compiles, but segfaults return 0; }
but, as noted, the selection without providing the object for copying creates a compiler error, and the selection with the provision of compilation of the object, but segfaults. Can someone explain why I cannot store these SSE objects in an STL container like this (or, better, provide the correct way to do this)?
source share