0

Why not able to use initializer list

Hi Tried to create a custom class having own iterator. Why below line does not work? myClass<int> obj({ 5,7,9,11,13,15,61 }); Isn't it get binded to myClass(initializer_list<T> lstData)? What can be done to define obj from main function? https://code.sololearn.com/c52WvnTAR09H

27th May 2022, 11:47 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Odpowiedź
0
Okay, so there were two errors. 1. You forgot to change lsData to m_data. 2. You have to initialized the variables in the same order as they are declared in class. https://code.sololearn.com/chbLhpbW0TW9/?ref=app
27th May 2022, 3:44 PM
Lama
Lama - avatar