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

履歴 編集

function
<ranges>

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

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

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

概要

番兵を取得する。

戻り値

  • (1), (2) : join_with_viewの番兵を返す

#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();
  auto end_it = r.end();
  while (it != end_it) {
    char x = *it;
    std::cout << x;
    ++it;
  }
  std::cout << std::endl;
}

出力

hello-world-join

バージョン

言語

  • C++23

処理系