I have a question about the new shortcut way of defining vectors in c++11. Suppose I have the following class
struct Tester{
vector< vector<int> > data;
Tester(){
data = vector< vector<int> >();
}
void add(vector<int> datum){
data.push_back(datum);
}
};
Then, the following works as expected:
int main(){
Tester test = Tester();
vector<int> datum = vector<int>{1,2,3};
test.add(datum);
}
but this doesn't:
int main(){
Tester test = Tester();
test.add(vector<int>{1,2,3});
}
Can someone please explain the difference to me? How can I do the shortcut I attempt in the second main()?