+ 2
C++ STL
In a vector<int> v; what is the difference between 1 and 2? void f(vector<int>& v) { v[0]; // 1. v.at(0); // 2. }
2 Respostas
+ 3
its better to use 2nd because you can change your data structure easily in future just by changing vector to list (for example) in definition line ; but in first one you have to replace v[] with v.at() in order to use map or list or ...
+ 1
thx 4 d answer amir