Referring to this web site http://www.cplusplus.com/reference/std/utility/make_pair/
The std::make_pair has this signature (and possible implementation):
template <class T1,class T2>
pair<T1,T2> make_pair (T1 x, T2 y)
{
return ( pair<T1,T2>(x,y) );
}
I am wondering why std::make_pair has input parameter by value and not by const references?
Is there any particular reason for this?
It originally was taking the parameters by const reference, but that introduced some unexpected problems. It was changed to pass by value after a defect report:
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#181
It is expected that the compiler will inline the function and be able to optimize away the parameter passing most of the time.