Standard library header <initializer_list> (C++11)
From cppreference.net
C++
Standard library headers
此头文件属于 语言支持 库的一部分。
类 |
|
|
(C++11)
|
引用在
列表初始化
中创建的临时数组
(类模板) |
函数 |
|
|
重载
std::begin
(函数模板) |
|
|
(C++11)
|
特化
std::end
(函数模板) |
概要
// 所有独立实现 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 size_t size() const noexcept; // 元素数量 constexpr const E* begin() const noexcept; // 首元素 constexpr const E* end() const noexcept; // 末元素后一位置 }; // 初始化列表范围访问 template<class E> constexpr const E* begin(initializer_list<E> il) noexcept; template<class E> constexpr const E* end(initializer_list<E> il) noexcept; }