0

What is the difference between std::list::insert() and std::list::emplace()? I need to pass a value to either of them. I had expected emplace to create an instance of the list's data type without initializing it with some value I pass but just construct it, because the documentation says that it constructs a new element in place.

Razzupaltuff
  • 2,250
  • 2
  • 21
  • 37
  • https://stackoverflow.com/questions/14788261/c-stdvector-emplace-vs-insert https://stackoverflow.com/questions/4303513/push-back-vs-emplace-back – Kenny Ostrom Nov 04 '21 at 18:07
  • So the only difference is that I can pass a variadic list of arguments to emplace? Meh. That could have just as well been done with an overload of insert(). – Razzupaltuff Nov 04 '21 at 18:12

0 Answers0