I thought vectors were supposed to resize themselves. But this crashes on my compiler:
But this doesn't:Code:#include <vector> int main(void) { std::vector<int> v; for(int x = 0; x < 10; x ++) { v[x] = x; } return 0; }
What's happening here?Code:#include <vector> int main(void) { std::vector<int> v(10); for(int x = 0; x < 10; x ++) { v[x] = x; } return 0; }