C++

Asked • 10/07/19

push_back vs emplace_back?

I'm a bit confused regarding the difference between `push_back` and `emplace_back`. void emplace_back(Type&& _Val); void push_back(const Type& _Val); void push_back(Type&& _Val); As there is a `push_back` overload taking a rvalue reference I don't quite see what the purpose of `emplace_back` becomes?

1 Expert Answer

By:

David A. answered • 10/10/19

Tutor
4.7 (14)

Experienced C++ tutor who loves to mentor and pass on my knowledge

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.