Is there any valid reason why would one prefer one pair over the other over the third over the fourth in the following sample?
map<const int, int> test;
test.insert(const pair<const int, int>(3, 9));
test.insert(const pair<int, int>(3, 9));
test.insert(pair<int, int>(3, 9));
test.insert(pair<const int, int>(5, 9));
Basically yes. A dumb compiler will invoke one extra conversion constructor in this code
but an optimizing compiler will make it the same as other alternatives.
I only ask, who would want to write code like this? Normally, I would write
test.insert(std::make_pair(3, 9))and wouldn’t care.