I am learning C++ programming on my own by trying to take CS 106L Standard C++ Programming course. I am solving Assignment 2: HashMap Milestone 3: Operator Overloading. However, I am stuck here due to my lack of knowledge. To understand my problem you have to view the highlighted bullet point in the attached image . M is mapped value which is a template parameter that is passed to my template class. Why is it saying that “The default value of the mapped type is simply the type you get by calling that type’s default constructor (i.e. M val;)”. What if M (template argument) is an ordinary integral type. How can I take the default value of that type? What if M (class type) does not have a default constructor then won’t this code break up. I am so confused here about providing default values for a template parameter which I do not know at the time of implementation what it could be. It could be any valid C++ type.
Can someone please help me here.