vector
, valarray
, and array
Perhaps you are wondering why C++ has three array templates: vector
, valarray
, and array
. These classes were developed by different groups for different purposes. The vector
template class is part of a system of container classes and algorithms. The vector
class supports container-oriented activities, such as sorting, insertion, rearrangement, searching, transferring data to other containers, and other manipulations. The valarray
class template, on the other hand, is oriented toward numeric computation, and it is not part of the STL. It doesn’t have push_back()
and insert()
methods, for example, but it does provide a simple, intuitive interface for many mathematical operations. Finally, array
is designed as a substitute ...
Get C++ Primer Plus now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.