Possible Duplicate:
C++11 emplace_back on vector<struct>?
Is emplacement possible with PODs? It does not seem to work in Visual Studio 2012:
struct X
{
int a;
int b;
};
void whatever()
{
std::vector<X> xs;
X x = {1, 2};
// okay
xs.push_back(x);
// okay
xs.emplace_back(x);
//error C2661: 'X::X': error C2661: no overloaded function takes 2 arguments
xs.emplace_back(1, 2);
}
Is this just a shortcoming of Visual Studio 2012, or does emplacing a POD simply not work in C++11?