Emplace() instead of push_back() in 9.3?

#1

Wondering what the rationale is for using emplace instead of push_back in the well-formed problem. Really, wondering why it’s used at all over push_back.

Any info’s greatly appreciated.

0 Likes

#2

Hey Piper,

You could take a look of this article for more information http://stackoverflow.com/questions/26198350/understanding-stack-functions-push-vs-emplace.

Please let me know if you have any other questions.

0 Likes

#3

@tsunghsienlee The link talks about rvalue references and variadic templates – but I still don’t understand. Can you provide a different perspective?

0 Likes

#4

Hey Piper,

http://stackoverflow.com/questions/4303513/push-back-vs-emplace-back might be a good explanation also. Basically I will say they are the same but with some slight performance and usage difference.

1 Like