Files
cppdraft_translate/cppdraft/initializer/list/syn.md
2025-10-25 03:02:53 +03:00

1.8 KiB

[initializer.list.syn]

17 Language support library [support]

17.11 Initializer lists [support.initlist]

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

// all freestandingnamespace std {template 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 size_t size() const noexcept; // number of elementsconstexpr const E* begin() const noexcept; // first elementconstexpr const E* end() const noexcept; // one past the last element}; // [support.initlist.range], initializer list range accesstemplate constexpr const E* begin(initializer_list il) noexcept; template constexpr const E* end(initializer_list il) noexcept;}

1

#

An object of type initializer_list 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]

2

#

If an explicit specialization or partial specialization ofinitializer_list is declared, the program is ill-formed.