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::
If you know you will only ever need 101 elements, use std::array:
class A
{
//...
private:
std::array m_data;
};
If you might need more and you just want to give it a default size, use an initializer list:
class A
{
public:
A() : m_data(101) {} // uses the size constructor for std::vector
private:
std::vector m_data;
};