[Cs3] using make_pair or constructor
Mikhail Nesterenko
mikhail at cs.kent.edu
Wed Sep 27 20:36:56 EDT 2017
CS3 students,
This is regarding today's question on using constructor
vs. make_pair. Both variants are acceptable:
auto ret = employees.insert(std::make_pair(num,name));
auto ret = employees.insert(std::pair<int,string>(num,name));
However, in case of make_pair, the compiler deduces the type of the
elements of pair which saves some typing.
Thanks,
--
Mikhail
More information about the cs3
mailing list