I currently have struct where I initialize only two of three member. I purposefully do this since during the time of creation I am not sure what the value will be ( I actually am fine with it being just zero).
struct my_data {
my_data(int x_, int y_) {
x = x_;
y = y_;
}
int x;
int y;
double z = 0;
};
int main() {
std::vector<my_data> my_vec;
my_vec.resize(10);
}
When I do this I get error: no matching function for call .... _T1(std::forward<Args ..
Is there any way to avoid this error or should I have to include z also in as parameter in constructor.
Aucun commentaire:
Enregistrer un commentaire