+ 2
Why [] not working on map for custom class
Hi Trying to create a map of int and custom class object as below: Able to insert element using insert method but not working when I use subscript operator. m[2] = obj is not working if m is declared as map<int,clsTest> What's the issue here ? https://code.sololearn.com/cjiVtbLzPZAU/?ref=app
1 Respuesta
+ 1
[] of map need class object to be default constructible. Added default constructor and error is gone.