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

履歴 編集

function
<ranges>

std::ranges::join_with_view::begin(C++23)

constexpr auto begin()
  requires (!simple-view<V>);       // (1) C++23

constexpr auto begin() const
  requires range<const V> &&
           input_range<range_reference_t<const V>> &&
           range<const Pattern>;     // (2) C++23

概要

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

戻り値

  • (1), (2) : join_with_viewの先頭を指すイテレータを返す。外側のRangeが空でない場合、最初の内側Rangeの先頭要素を指す。外側のRangeが空の場合、end()と等価なイテレータを返す。

#include <ranges>
#include <vector>
#include <string>
#include <iostream>

int main() {
  std::vector<std::string> words = {"hello", "world", "join"};
  std::string delimiter = "-";

  std::ranges::join_with_view r{words, delimiter};

  auto it = r.begin();

  char x = *it;
  std::cout << x << '\n';
}

出力

h

バージョン

言語

  • C++23

処理系