Table of Contents
Preface
Part 1: Mastering std::vector
1
The Basics of std::vector
Technical requirements
The significance of std::vector
A basic comparison of C-style arrays and std::vector
Comparison of C-style arrays and std::vector for memory management
Declaring and initializing std::vector
Declaring a vector
Initializing a vector
Accessing elements
Random access
Accessing the first and last elements
Vector size
Adding and removing elements
Adding elements
Removing elements
Capacity
Prefer using empty() when possible
Clearing all elements
Summary
2
Mastering Iterators with std::vector
Technical requirements
Types of iterators in the STL
Input iterators
Output iterators
Forward iterators
Reverse iterators
Bidirectional iterators
Random ...
Get Data Structures and Algorithms with the C++ STL 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.