Why is this <int, auto> card not allowed?

I am trying to implement a heterogeneous map in C ++. I know this was discussed earlier, but I was wondering why the following is not allowed:

map<int, auto> myMap;

Is there anyway that I could make inserting onto a map simple without resorting to pointers (void *)?

I thought that in the end I could do something like this:

vector<int> v;
myMap.insert(make_pair<int, int>(1,12334));
myMap.insert(make_pair<int, vector<int>)(2, v));

Is it possible? or are my efforts in vain?

thank

+3
source share
4 answers

auto , " ". , , " , ". auto , ; , . auto , , .

+19

, ?

- variant any boost. , .

+5

, . , .

+2

, . , ( switch), , . Boost Variant .

+2

All Articles