36 lines
1.8 KiB
Markdown
36 lines
1.8 KiB
Markdown
[initializer.list.syn]
|
||
|
||
# 17 Language support library [[support]](./#support)
|
||
|
||
## 17.11 Initializer lists [[support.initlist]](support.initlist#initializer.list.syn)
|
||
|
||
### 17.11.2 Header <initializer_list> synopsis [initializer.list.syn]
|
||
|
||
// all freestandingnamespace 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 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]](support.initlist.range "17.11.5 Initializer list range access"), initializer list range accesstemplate<class E> constexpr const E* begin(initializer_list<E> il) noexcept; template<class E> constexpr const E* end(initializer_list<E> il) noexcept;}
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4686)
|
||
|
||
An object of type initializer_list<E> provides access to an array of
|
||
objects of type const E[.](#1.sentence-1)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
A pair of pointers or a pointer plus
|
||
a length would be obvious representations for initializer_list[.](#1.sentence-2)
|
||
|
||
initializer_list is used to implement initializer lists as specified
|
||
in [[dcl.init.list]](dcl.init.list "9.5.5 List-initialization")[.](#1.sentence-3)
|
||
|
||
Copying an initializer_list does not copy the underlying
|
||
elements[.](#1.sentence-4)
|
||
|
||
â *end note*]
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4697)
|
||
|
||
If an explicit specialization or partial specialization ofinitializer_list is declared, the program is ill-formed[.](#2.sentence-1)
|