One sure and apparent meaning, found in a customary library - initializing
a collection with a list of the elements:std::vector v = {1, 2, 3};What
are other use cases for std::initializer_list constructors? If possible,
with examples from genuine code.It's indeed a doubt about category
design.Because of some pecularities of list-initialization adding an
std::initializer_list constructor to already existent category can simply
an surprisingly be a defilement change, so when minute a new category we
should always know in lay if it will ever need an std::initializer_list
constructor.So, I'm perplexing to duplicate a ability to see a destiny by
minute out use cases for std::initializer_list constructors.
No comments:
Post a Comment