mardi 8 mai 2018

initialize part of a const std::map from another const std::map

I have a const std::map< int, std::string> initialized like so:

const std::map< int, std::string > firstMap = {
    { 1, "First" },
    { 2, "Second"}
};

Then I want to make another const std::map which uses the first map as part of its initial values and also has extends the original data. So it would be something similar to this I guess:

const std::map< int, std::string > secondMap = {
    { <firstMap>},
    { 3, "Third"}
};

so that the secondMap has the three pairs. Is this possible?

Aucun commentaire:

Enregistrer un commentaire