Skip to content

Latest commit

 

History

History
56 lines (44 loc) · 1014 Bytes

File metadata and controls

56 lines (44 loc) · 1014 Bytes

begin

  • string_view[meta header]
  • std[meta namespace]
  • basic_string_view[meta class]
  • function[meta id-type]
  • cpp17[meta cpp]
constexpr const_iterator begin() const noexcept;

概要

先頭の要素を指すイテレータを取得する。

戻り値

!empty()である場合、data()を指すイテレータを返す。そうでない場合、[begin(), end())を妥当な範囲とする未規定の値を返す。

#include <iostream>
#include <string_view>
#include <algorithm>

int main()
{
  std::string_view sv = "Hello";

  std::for_each(sv.begin(), sv.end(), [](char c) {
    std::cout << c << std::endl;
  });
}
  • begin()[color ff0000]
  • sv.end()[link end.md]

出力

H
e
l
l
o

バージョン

言語

  • C++17

処理系