This works fine:
#include <iostream>
#include <map>
using namespace std;
struct Bar
{
int i;
int f;
};
int main()
{
map<int, Bar> m;
Bar b;
b.i = 1;
b.f = 2;
m[0] = b;
}
But if I want to make it a little more concise, I get errors:
int main()
{
map<int, Bar> m;
m[0] = {1, 2};
}
Is there any way to make that struct initialization syntax work? Am I doing it wrong, or is it prohibited for maps?