P
pmatos
Hi all,
I have a struct with a:
static map<int, int> rules;
Now, I want it to always be initialized with the pairs (-1, 1), (-2, 2)
and (-3, 3). I don't need to dynamically add or delete pairs. I only
need the struct to have this constant static map. How can I initialize
it?
I've tried some solutions like having in the struct constructor:
rules[-1] = 1;
rules[-2] = 2;
rules[-3] = 3;
But it doesn't work. Can somebody help me with this?
Cheers,
Paulo Matos
I have a struct with a:
static map<int, int> rules;
Now, I want it to always be initialized with the pairs (-1, 1), (-2, 2)
and (-3, 3). I don't need to dynamically add or delete pairs. I only
need the struct to have this constant static map. How can I initialize
it?
I've tried some solutions like having in the struct constructor:
rules[-1] = 1;
rules[-2] = 2;
rules[-3] = 3;
But it doesn't work. Can somebody help me with this?
Cheers,
Paulo Matos