Suppose I have the following piece of code:
#include <bits/stdc++.h>
using namespace std;
class SomeClass {
private:
const static map<int, int> some_map;
};
const map<int, int> SomeClass::some_map = {
{1, 2},
{3, 2},
{4, 2},
{10, 3},
{11, 3},
{12, 3},
{15, 9}
};
As you can see, I initialize several keys of the map to the same value.
Would it be possible to express the same thing in any shorter syntax (i.e. something like: {1,3,4->2}
)? This is just a short example but in reality I have many keys with the same value and would like to retrieve this value quickly.