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

36 lines
1.8 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.5Initializer 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.5List-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)