I'm trying to set length and initialize a vector
member of a class, but it seems it's only possible if initializing line is out of class.
//a vector, out of class set size to 5. initialized each value to Zero
vector<double> vec(5,0.0f);//its ok
class Bird{
public:
int id;
//attempt to init is not possible if a vector a class of member
vector<double> vec_(5, 0.0f);//error: expected a type specifier
}
How can I do this inside the class?
vector<double> vec_ = vector<double>(5, 0.0f);
– Riches