+ 1
Why initializer_list is not working
Hi I tried to implement queue using two stacks and it works fine as below: https://code.sololearn.com/cg5Iz87Ve3AC My query is related to initializer list. Why below code fails even though a constructor with initializer list is provided for myQueue class? //myQueue q1 {1, 2, 3};
1 ответ
+ 4
Pass the std::initializer_list by value or const ref, though pass by value is preferred for an initializer_list since it's very cheap.