I'm not quite sure what you mean by βwithout any value,β but if you mean without explicitly assigning a value, just do
map[valid_keys[i]];
This still works, that is, it creates a new record on the map if there was no key with this key before. operator[] just returns a reference to the value so you can assign it a new value, but remember that it has already been configured by default.
If, on the other hand, you mean that you want to express that there is no significant value, and it may or may not subsequently receive a real value, then see @ UncleBens answer .
Troubadour
source share