Namespaces
Variants
Actions

std::ranges::adjacent_view<V,N>::reserve_hint

From cppreference.com
< cpp‎ | ranges‎ | adjacent view
 
 
Ranges library
 
std::ranges::adjacent_view
adjacent_view::reserve_hint
(C++26)
Member functions
Non-member functions
 
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_ ))>;
using CT = ranges::common_type_t <DT, std::size_t >;
auto sz = static_cast<CT>(ranges::reserve_hint(base_ ));
sz -= std::min <CT>(sz, N - 1);
return to-unsigned-like(sz);

[edit] Return value

The approximate size of the resulting range.

[edit] Notes

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

[edit] Example

This section is incomplete
Reason: no example

[edit] See also

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

AltStyle によって変換されたページ (->オリジナル) /