- forward_list[meta header]
- std[meta namespace]
- forward_list[meta class]
- function[meta id-type]
- cpp11[meta cpp]
iterator begin() noexcept;
const_iterator begin() const noexcept;先頭要素を指すイテレータを取得する。
先頭要素を指すイテレータ
投げない
#include <iostream>
#include <forward_list>
int main()
{
std::forward_list<int> ls = {1, 2, 3};
const std::forward_list<int>& cls = ls;
decltype(ls)::iterator i = ls.begin();
decltype(ls)::const_iterator ci = cls.begin();
std::cout << *i << std::endl;
std::cout << *ci << std::endl;
}- begin()[color ff0000]
1
1
- C++11
- Clang: ??
- GCC: 4.7.0
- ICC: ??
- Visual C++: 2010, 2012, 2013, 2015, 2017