Talk

Insights Into std::vector<T>::push_back()

In Russian

std::vector<T> in the standard library and a vector in general are one of the most fundamental types, and push_back() is one of the most fundamental operations on a vector (and overall considering other containers). It is important to understand this building block well.

In this talk we will cover virtually all the theory around std::vector<T>::push_back(), which then will help us to speed up this code:

c++

std::vector<ItemType> parse(std::input_iterator auto begin,

              std::input_iterator auto end) {

 std::vector<ItemType> parsed;

 for (const auto &i : std::ranges::subrange{ begin, end })

  parsed.push_back(parseDataPoint(i));

 return parsed;

}

After this talk you will have a good understanding of how std::vector<T>::push_back() works, and you will learn to identify optimization opportunities by the example of speeding up code that uses push_back().

Schedule