I have an unordered_map
which stores <string, A>
pairs. I wanted to emplace pairs with this snippet:
map.emplace(std::piecewise_construct,
std::forward_as_tuple(name),
std::forward_as_tuple(constructorArg1, constructorArg1, constructorArg1));
But if my A
class doesn't have a default constructor then it fails to compile with this error:
'A::A': no appropriate default constructor available
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\tuple 1180
Why does it need a default constructor and how can I avoid the use of it?