c++ - std::map initialization with a std::vector -


I want to initialize the object std :: map with the key contained in std Am :: vector object

  std :: vector & lt; Char & gt; Marquez {'A', 'B', 'C']; Std :: map & lt; Char, int & gt; MyMap;  

How can I do this without any loop?

And can I add a default value to my int ?

without clear loop:

  Std :: transform (std :: start (mykeys), std :: end (mykeys), std :: inserter (myMap, myMap.end ()), [] (four c) {return std :: make_pair (c, 0);});  

.

For a loop, a category-based, however, will be more sexy, so if it is possible, use it:

 for  (Auto C: Michez) myMap.emplace (c, 0);  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -