When to use emplace* and when to use push/insert [duplicate]
问题 This question already has answers here : push_back vs emplace_back (7 answers) Closed 6 years ago . I know of general idea of emplace functions on containers("construct new element inplace"). My question is not what it does, but more of like Effective C++11 one. What are good rules for deciding when to use (for eg when it comes to std::vector ) emplace_back() and when to use push_back() and in general emplace* vs "old" insert functions? 回答1: emplace_back() only really makes sense when you