I'm trying to resize a vector in the class. I don't know where is the error. Hope you can help me.
This is my code:
class State {
private:
vector<int> numbers;
int score;
public:
int getScore() {
return score;
}
void setScore(int score) {
this->score = score;
}
int getSize () {
return this->numbers.size();
}
void setSize(int size) {
this->numbers.clear();
this->numbers.resize(size);
for (int i = 0; i < size; ++i)
this->numbers[i].resize(size);
}
};
When I try to compile, I get this error:
In file included from ./power.cpp:11:
./power.hpp:45:24: error: member reference base type 'value_type' (aka 'int') is not a structure or union
this->numbers[i].resize(size);
~~~~~~~~~~~~~~~~^~~~~~~
1 error generated.
Hope you can help me.
Thanks in advance :)
intluring atnumbers[i].