hi All
i have a basic doubt as i was reading about the STL class Vector.
There are some operations that are provided in the vector. As the vector class template provides the stack operations, list operations. There are some functions which are related to memory as in size(), capacity(), reserve().
Now the query is : when i try to use the vector class as a list, how reserve() can be used and what is the significance ? when i say reserve(100), does this mean that the 100 * sizeof (<build in data type / user defined data type>) bytes gets sequentially allocated but not initialized ? what is the use of sequential allocation when i try to use vector as a list?
Some help on explaining how reserve() works will be appriaciated...
thanks in advance
sanjay
i have a basic doubt as i was reading about the STL class Vector.
There are some operations that are provided in the vector. As the vector class template provides the stack operations, list operations. There are some functions which are related to memory as in size(), capacity(), reserve().
Now the query is : when i try to use the vector class as a list, how reserve() can be used and what is the significance ? when i say reserve(100), does this mean that the 100 * sizeof (<build in data type / user defined data type>) bytes gets sequentially allocated but not initialized ? what is the use of sequential allocation when i try to use vector as a list?
Some help on explaining how reserve() works will be appriaciated...
thanks in advance
sanjay