I want to use a map to refer to a type specifier mainly to shorten my code from multiple uses of 

```
std::unique_ptr< Class >(new class1);

```

to

```
std::unique_ptr< Class >(new sampleMap[enum1]);

```

and then define my map so that it refers each enum value (`enum1`, `enum2`, ...) to my classes (`class1`, `class2`, ...).

But I cannot define my map with the values being a type name like this

```
std::map < int, Class > mapName {
{0, class1},
{0, class1},
...
};

```

since type name is not allowed in maps.

The main reason I'm looking for an answer for this is to make my code more succinct by replacing a series of "`if`/`else if`" statements or "`switch`-case" statements into only one line of code where the output `std::unique_ptr<Class>(new class1);` is dynamically figured out through the map that I define. So, I just input the enum number and get the corresponding class instantiated for me. Otherwise, I would have to do this:

```
if (enum1 = 0)
{
    std::unique_ptr< Class >(new class1);
}
else  if (enum2 = 0)
{
    std::unique_ptr< Class >(new class2);
}

```

(or a switch-case)
But I want to do all above in one line like this:

```
std::unique_ptr<Class>(new sampleMap[enum1]);

```

plus the map declaration.

Any clue how this could be done?