I wondered what are the benefits of using std::initializer_list
, and what purpose does it serve.
I encountered the following: Why is list initialization (using curly braces) better than the alternatives?
and understood that the "non-narrowing" effect, although I can't really see how beneficial it is.
Another benefit I can spot, is the relative ease of use when initializing ( for example when initializing a class with several members ), but besides that I don't see any major improvement, which really makes initialization using initializer_list a good practice, especially in terms of efficiency.