First page Back Continue Last page Overview Graphics
Containers in C++
Perl lists and arrays are C++ vectors.
Perl hashes are C++ maps.
C++ containers are generic – they can contain any particular type. They use templates.
C++ has many more container types than Perl: vector, list, map, multimap, deque, stack, queue and priority_queue.
Notes:
Perl's lists map closest to C++ vectors, but also list in C++. That's optimised for insertions/removals and can't be subscripted.
Deque is a double-ended queue, pronounced “deck”. It combines vector's accessibility with list-like speed for additions/removals at the ends.