Frequently Quite Prolix
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
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.
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.