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

履歴 編集

function
<ranges>

std::ranges::drop_view::reserve_hint(C++26)

constexpr auto reserve_hint()
  requires approximately_sized_range<V>;       // (1) C++26

constexpr auto reserve_hint() const
  requires approximately_sized_range<const V>; // (2) C++26

概要

要素数の近似値を取得する。

drop_viewは元のRangeから先頭 N 個を取り除くため、近似値は「元のRangeのreserve_hint − N」(負になる場合は 0)となる。

テンプレートパラメータ制約

効果

以下と等価:

const auto s = static_cast<range_difference_t<V>>(ranges::reserve_hint(base_));
return to-unsigned-like(s < count_ ? 0 : s - count_);

バージョン

言語

  • C++26

処理系

参照