What is the purpose of std::make_pair?
Why not just do std::pair?
Is there any difference between the tw
It's worth noting that this is a common idiom in C++ template programming. It's known as the Object Generator idiom, you can find more information and a nice example here.
Edit As someone suggested in the comments (since removed) the following is a slightly modified extract from the link in case it breaks.
An Object Generator allows creation of objects without explicitly specifying their types. It is based on a useful property of function templates which class templates don't have: The type parameters of a function template are deduced automatically from its actual parameters. std::make_pair is a simple example that returns an instance of the std::pair template depending on the actual parameters of the std::make_pair function.
template
std::pair
make_pair(T t, U u)
{
return std::pair (t,u);
}