This is the last part of the series, in which I will discuss the **erase** method group. The purpose of these methods is to delete one or more elements from a vector. We will see that the implementation of these methods is wrong. Continue reading

# Category Archives: C++

# Dissecting the C++ STL Vector: Part 4 – Insertion

Part 4 of the series will cover one of the two most important features of the vector container, namely insertion. The next part will cover deletion, which will be last part about the source code. Future parts will cover the theory behind the vector container. We will be interested in only the **insert** method group. Continue reading

# Dissecting the C++ STL Vector: Part 3 – Capacity & Size

This is the third part of a series about dissecting the vector container in C++. It depends on the first part and the second part, so make sure that you have read them before continuing. In this part, I will dissect the “capacity” methods of the vector template. That is, **size**, **max_size**, **resize**, **capacity**, **empty**, **reserve**, and **shrink_to_fit**. It will be relatively simpler than the previous parts. In fact, as you will see, the implementation of most of these methods is obvious. My goal is to help you be more familiar with the vector template before I start discussing the most important methods, namely **insert** and **erase**. Continue reading

# Dissecting the C++ STL Vector: Part 2 – Constructors

This is the second part of a series about dissecting the vector container in C++. It depends on the first part, so make sure that you have read it before continuing. In this part, I will dissect the constructors of the vector container. You will learn about all the fields of a vector instance, what do they represent, and how they are being initialized. You will be able to compute the size of any vector instance. Also you will see how allocators are involved into construction and the exceptions that might occur along the way. Continue reading