Namespaces
Variants

std::ranges::slide_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以降)

次と同等

using DT = ranges:: range_difference_t < decltype ( ( base_ ) ) > ;
auto sz = static_cast < DT > ( ranges :: reserve_hint ( base_ ) ) - n_ + 1 ;
if ( sz < 0 )
sz = 0 ;
return to-unsigned-like ( sz ) ;

目次

戻り値

結果の範囲のおおよそのサイズ。

注記

機能テスト マクロ 標準 機能
__cpp_lib_ranges_reserve_hint 202502L (C++26) ranges::approximately_sized_range および reserve_hint (1,2)

関連項目

要素数を返す。基盤となる(適応された)範囲が sized_range を満たす場合にのみ提供される
(公開メンバ関数)