←back to thread

178 points todsacerdoti | 1 comments | | HN request time: 0.213s | source
Show context
sillysaurusx ◴[] No.26341228[source]
Lazy HN: Is emplace_back new? I was a C++ dev for over a decade and never came across it. But I got out of serious gamedev in 2014 or so (sadly).

(Is this what it feels like to become a dinosaur?)

There is some confusion on this issue: https://stackoverflow.com/questions/4303513/push-back-vs-emp...

The function void emplace_back(Type&& _Val) provided by MSCV10 is non conforming and redundant, because as you noted it is strictly equivalent to push_back(Type&& _Val).

Looks like (as usual) MSVC's lackluster implementation drives real-world usage. Is there a rule of thumb?

replies(1): >>26341259 #
1. gpderetta ◴[] No.26341259[source]
It was added in C++11 as part of the perfect forwarding changes, so I would say that it is about a decade old.

As an aside, if you check cppreference.com it will tell you which standard added (or removed) a specific API.