C++ - <initializer_list>
An initializer_list object is designed to hold an array of values. An initializer_list object is automatically constructed when:
- a braced-init-list is used to list-initialize an object, where the corresponding constructor accepts an initializer_list parameter.
- a braced-init-list is used as the right operand of assignment or as a function call argument, and the corresponding assignment operator/function accepts an initializer_list parameter.
- a braced-init-list is bound to auto, including in a ranged for loop.
The initializer_list object refers to the elements of this array without containing them. Copying an initializer_list object produces another object referring to the same underlying elements, not to new copies of them.
template <class T> class initializer_list;
||Type of the elements stored in the initializer_list.|
|value_type||T (First template parameter)|
C++ <initializer_list> - Member Functions
The C++ <initializer_list> has a number of member functions which are listed below:
|begin()||Returns a pointer to the first element of the initializer_list.|
|end()||Returns a pointer to the past-the-last element of the initializer_list.|
C++ <initializer_list> - Non-member Functions
The C++ <initializer_list> has a number of non-member functions which are listed below: