std::ranges::drop_view<V>::reserve_hint

来自cppreference.com
< cpp‎ | ranges‎ | drop view
 
 
范围库
范围适配器
 
 
constexpr auto reserve_hint()
    requires ranges::approximately_sized_range<V>
(1)(C++26 起)
constexpr auto reserve_hint() const
    requires ranges::approximately_sized_range<const V>
(2)(C++26 起)

W 对于重载 (1)V,对于重载 (2)const V。等价于

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

返回值

结果范围的估计大小。

注解

功能特性测试标准功能特性
__cpp_lib_ranges_reserve_hint202502L(C++26)ranges::approximately_sized_rangereserve_hint (1,2)

示例

参阅

返回元素数,仅当底层(适配的)范围满足 sized_range 时才提供
(公开成员函数)