lundi 25 mars 2019

Adding empty element to declared container without declaring type of element

When we use a complicated container in C++, like
std::vector<std::map<std::string, std::set<std::string>>> table;
the only way to add an empty map (which may represent a row or column) is to initialize a new element and push it back
table.push_back(std::map<std::string, std::set<std::string>>());
Is there any way to avoid redeclaring the type, and just adding the correct typed element?

Aucun commentaire:

Enregistrer un commentaire