#
The approximately_sized_range concept refines range with the requirement that an approximation of the number of elements in the range can be determined in amortized constant time using ranges​::​reserve_hint.
template<class T> concept approximately_sized_range = range<T> && requires(T& t) { ranges::reserve_hint(t); };
2
Given an lvalue t of type remove_reference_t<T>, T models approximately_sized_range only if
  • ranges​::​reserve_hint(t) is amortized
  • if iterator_t<T> models forward_iterator, ranges​::​reserve_hint(t) is well-defined regardless of the evaluation of ranges​::​begin(t).
    [Note 1: 
    ranges​::​reserve_hint(t) is otherwise not required to be well-defined after evaluating ranges​::​begin(t).
    For example, it is possible for ranges​::​reserve_hint(t) to be well-defined for an approximately_sized_range whose iterator type does not model forward_iterator only if evaluated before the first call to ranges​::​begin(t).
    — end note]

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant