I was wondering if it is OK to always use emplace
to replace insert
when inserting a single element into a STL container, like set, unordered_set?
From the signature, emplace
is simpler and do not involve overloads. Is there any issue with stop using insert
and use emplace
all the time?
Note: there are SO questions asking about the difference between emplace
and insert
/push_back
etc. (e.g. here, here, and here) I understand the difference, and it seems to me that emplace
is better in every way. I just want to confirm if it's OK to deprecate insert
.