Abstract
Suppose that you have a problem in which you need an array, but the size of the array can’t be known at the time at which you create it. An example is when you need to read in data from a file of unknown size and process it. You need to create the array in which you wish to put the data before you begin to read the file, but you won’t know until the end of the file how much data there is. Vectors are ideal for this kind of problem, provided that the problem only requires the array to grow at one end. If it must grow at both ends, then a deque is better suited to the task. Here we are assuming, of course, that the other processing required of the data requires an array-like structure. If we don’t require random access iterators in our processing, then a list will probably be a better choice in which to hold the data.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 1998 Springer Science+Business Media New York
About this chapter
Cite this chapter
Bergin, J. (1998). Vector Programming. In: Data Structure Programming. Undergraduate Texts in Computer Science. Springer, New York, NY. https://doi.org/10.1007/978-1-4612-1630-8_5
Download citation
DOI: https://doi.org/10.1007/978-1-4612-1630-8_5
Publisher Name: Springer, New York, NY
Print ISBN: 978-1-4612-7223-6
Online ISBN: 978-1-4612-1630-8
eBook Packages: Springer Book Archive