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) (since C++26)
constexpr auto reserve_hint ( ) const
requires ranges :: approximately_sized_range < const V >
(2) (since C++26)

Equivalent to

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 ) ;

Contents

Return value

The approximate size of the resulting range.

Notes

Feature-test macro Value Std Feature
__cpp_lib_ranges_reserve_hint 202502L (C++26) ranges::approximately_sized_range and reserve_hint (1,2)

Example

See also

returns the number of elements, provided only if the underlying (adapted) range satisfies sized_range
(public member function)