Namespaces
Variants

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

From cppreference.net
Ranges library
Range adaptors
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_hint 202502L (C++26) ranges::approximately_sized_range reserve_hint (1,2)

示例

参阅

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