top of page
The Big C++ Blog



push_back() vs emplace_back(): The Benchmark That Made Me Delete a Post
I had to delete my previous post because the benchmark lied to me. That is already a very C++ way to start a day. The topic sounded simple enough: compare push_back() and emplace_back() for std::vector<std::string>, show the results for C++11 and C++23, and extract a nice practical lesson. Simple, right? Well, not quite. At first, I used older compilers on Quick-Bench and got results that looked strange. Strange enough that after double-checking, I realized I had stepped on a
bottom of page