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

履歴 編集

function
<ranges>

std::ranges::basic_istream_view::コンストラクタ(C++20)

constexpr explicit
  basic_istream_view(basic_istream<CharT, Traits>& stream); // (1) C++20

概要

basic_istream_viewオブジェクトを構築する。

  • (1) : basic_istreamの参照を受け取るコンストラクタ

効果

  • (1) : addressof(stream)をメンバ変数stream_に保持する

#include <ranges>
#include <sstream>
#include <iostream>

int main() {
  auto iss = std::istringstream{"1 2 3 4 5"};

  for (int i : std::views::istream<int>(iss)) {
    std::cout << i;
  }
}

出力

12345

バージョン

言語

  • C++20

処理系