In C++, how do I include a 101 elements vector as a data member in my class? I\'m doing the following, but it doesn\'t seem to be working:
private:
std::
You can't use the normal construction syntax to construct an object in the class definition. However, you can use uniform initialization syntax:
#include
class C {
std::vector integers{ 101 };
};
If you need to use C++03, you have to constructor your vector from a member initializer list instead:
C::C(): integers(101) { /* ... */ }