I’m using maps for the first time and I realized that there are many ways to insert an element. You can use emplace()
, operator[]
or insert()
, plus variants like using value_type
or make_pair
. While there is a lot of information about all of them and questions about particular cases, I still can’t understand the big picture.
So, my two questions are:
-
What is the advantage of each one of them over the others?
-
Was there any need for adding emplace to the standard? Is there anything that wasn’t possible before without it?