I am defining a small function to create a histogram of a vector of integers, Initially I defined the following function that first test whether the key exists in the map be
It is guaranteed to be zero-initialized for built-in types, and default constructed for user-defined types. The guarantee is that if an element for a given key does not exist, one is inserted, with the mapped_type being value initialized. For built-in types such as int
, this means zero initialization.
More information in this reference.