Why is a default constructor required when storing in a map?

Because map requires DefaultConstructible values, since when using subscript operator and the key is not found it adds it mapped to a default constructed value.

Leave a Comment