I'm new to C++ programming language and currently reading C++ programming language fourth Edition book. As per the book, section 11.3.1 it gives list implementation model details in following parts :-
-
if the {}-list is used as a constructor argument, the implementation is as just as if you had used a ()-list. List elements are not copied except as by-value constructor arguments.
-
If the {}- list is used to initialize the element of an aggregate (an array or class without a constructor), each list element initializes an element of the aggregate. List elements are not copied except as by value- arguments to aggregate element constructor.
-
If the {}- list is used to construct an initializer_list object, each list element is used to initialize an element of the underlying array of the initializer_list. Elements are typically copied from the initializer_list to wherever we use them.
-
Can someone please suggest/provide a code example and a small explanation for above 3 parts ?
Aucun commentaire:
Enregistrer un commentaire