The following code fails to complete on the var foo (press the '.' , nothing happens).
Using the uniform init syntax of C++11 :
#include <iostream>
#include <utility>
#include <string>
namespace
{
void helloPair()
{
std::pair<std::string, int> foo{"front", 242};
std::cout << foo.first << std::endl;
std::cout << foo.second << std::endl;
}
}
int main()
{
helloPair();
}