Thursday, November 25, 2010

Default Constructors for Elements in a Map

If you have a map to a class or struct, that class or struct needs a default constructor.

The default constructor is needed because of operator[]. When you try to access a map element that doesn't exist, operator[] creates the element with the element's default constructor

No comments:

Post a Comment