Here's a basic struct (I hope)
struct SomeType {
float a;
float b;
float c;
float d;
SomeType(float, float, float, float);
};
And source
SomeType::SomeType(float na, float nb, float nc, float nd) : a(na), b(nb), c(nc), d(nd) {}
The I have a class
struct SomeClass {
static const SomeType v;
SomeClass();
};
When I then initialise it
const SomeType SomeClass::v(0,0,0,0);
My vales become inf or nan or -nan. Anyone seen this before, or know how to fix it?
Edit: Fixed type
Edit: This is quite close to my original example. I multiple classes with similar structure to SomeClass.
const SomeClass::v(0,0,0,0);
won't compile, since you didn't specify the type of v
.
Otherwise, this works for me (and should work).
Perhaps you should post a complete, compilable example in one code listing, so we can see what you really had in mind.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With