17 Language support library [support]

17.11 Initializer lists [support.initlist]

17.11.2 Header <initializer_list> synopsis [initializer.list.syn]

/ all freestanding namespace std { template<class E> class initializer_list { public: using value_type = E; using reference = const E&; using const_reference = const E&; using size_type = size_t; using iterator = const E*; using const_iterator = const E*; constexpr initializer_list() noexcept; constexpr const E* data() const noexcept; constexpr size_t size() const noexcept; / number of elements constexpr bool empty() const noexcept; constexpr const E* begin() const noexcept; / first element constexpr const E* end() const noexcept; / one past the last element }; }
An object of type initializer_list<E> provides access to an array of objects of type const E.
[Note 1: 
A pair of pointers or a pointer plus a length would be obvious representations for initializer_list.
initializer_list is used to implement initializer lists as specified in [dcl.init.list].
Copying an initializer_list does not copy the underlying elements.
— end note]
If an explicit specialization or partial specialization of initializer_list is declared, the program is ill-formed.

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant