Return Type of Emplace Methods
This is the last topic of discussion for map enhancements.
Since C++11 most of the standard containers got .emplace*
methods. With those methods, you could create a new object in place, without additional copying or temporary objects.
However, most of .emplace*
methods didn’t return any value - it was void
. Since C++17 this has changed, and they now return the reference type of the inserted object.
For example:
Get hands-on with 1400+ tech skills courses.