Vectors

std::vector
is a homogeneous container, for which it’s length can be adjusted at runtime. std::vector
needs the header <vector>
. As it stores its elements contiguously in memory, std::vector
support pointer arithmetic.
for
(
int
i
=
0
;
i
<
vec
.
size
();
++
i
){
std
::
cout
<<
vec
[
i
]
==
*
(
vec
+
i
)
<<
std
::
endl
;
// true
}