Reputation: 2655
Basically I have a wrapper around a SIMD structure that goes like this:
class MyClass
{
public:
MyClass();
__m128 SIMD;
};
I saw that in the DirectXMath SIMD math library from Microsoft they can do things like:
const XMVECTOR SinCoefficients0 = {-0.16666667f, +0.0083333310f, -0.00019840874f, +2.7525562e-06f};
where XMVECTOR just wraps around something like this:
union
{
float f[4];
__m128 entry;
};
I also tried to use a union with an array, but it still gives me the same error.
Upvotes: 1
Views: 2580
Reputation: 52365
In order to be able to use aggregate initialization, you need to remove the user-defined ctor and make sure all members are public:
struct MyClass
{
__m128 SIMD;
};
Please read aggregate initialization which explains what an aggregate is and how the initialization works.
Upvotes: 4