I am working on a C++ project that is restricted to, I believe, C++ 98, certainly new C++ 11 features don't work.
I am interested in constructing a vector from a plain old data array.
I input the following example from cplusplus.com:
int myints[] = {16,2,77,29};
std::vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) );
which doesn't say if the example is for C++ 98 or C++ 11 but I assume C++ 11 since I got the error: Too few template arguments for class template 'vector'
Is there a way with C++ 98 to do something similar/ how do I fix this error? I noticed that Xcode by default writes std::vector<<class T>, <class Allocator>> when I declare a vector.
Aucun commentaire:
Enregistrer un commentaire