首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::begin(std::initializer_list)

template< class E > const E* begin( initializer_list<E> il ) noexcept;

(since C++11) (until C++14)

template< class E > constexpr const E* begin( initializer_list<E> il ) noexcept;

(since C++14)

过载std::begininitializer_list返回指向il...

参数

il

-

an initializer_list

返回值

il.begin()...

二次

代码语言:javascript
复制
#include <iostream>
#include <initializer_list>
 
int main() 
{
    std::initializer_list<int> il = {3, 1, 4, 1};
    for(auto it = std::begin(il); it != std::end(il); ++it) {
        std::cout << *it << '\n';
    }
}

二次

产出:

二次

代码语言:javascript
复制
3
1
4
1

二次

另见

begin

returns a pointer to the first element (public member function)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券