It's because you are trying to assign to a type. QVector<double>
is a type, and not a variable declaration or anything else you can assign to. That means that both examples are actually wrong.
I think you mean to declare the member variable MyContainer
, for which you should use
QVector<double> MyContainer;
To initialize the container to a specific size, you have to use the constructors initializer list:
Device()
: MyContainer(100)
{
...
}
For more information about initializer lists, see e.g. this tutorial, or this reference.