最終更新日時(UTC):
が更新

履歴 編集

function
<sstream>

std::basic_istringstream::view(C++20)

basic_string_view<CharT, Traits> view() const noexcept;

概要

文字列ビューオブジェクトの取得を行う。

戻り値

rdbuf()->view()

#include <iostream>
#include <sstream>
#include <string_view>

int main()
{
  std::istringstream ss("Hello World");

  std::string_view sv = ss.view();

  std::cout << sv.substr(0, 5) << std::endl;  // "Hello"
}

出力

Hello

バージョン

言語

  • C++20

処理系

参照