Originally Posted by dwks
calls the operator() function. Like an array, a vector indexes its elements, and if the index doesn't exist then the operator() function fails.Code:
Vectors grow automatically in size when you add elements to the vector. There are several functions defined to allow you to add elements to a vector. However, operator() does not add elements to the vector--it tries to access elements that already exist. In a map<>, operator() does add elements to the map, but it doesn't work the same way with a vector.
If you want to add elements to a vector, then you have to use functions that do that.