Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::ranges::approximately_sized_range

      From cppreference.com
      <cpp‎ |ranges
       
       
      Ranges library
      Range adaptors
       
      Defined in header<ranges>
      template<class T>

      concept approximately_sized_range=ranges::range<T>&&
          requires(T& t){
              ranges::reserve_hint(t);

         };
      (since C++26)

      Theapproximately_sized_range concept specifies the requirements of arange type that can estimate its size in constant time with thereserve_hint function.

      Contents

      [edit]Semantic requirements

      Given an lvaluet of typestd::remove_reference_t<T>,T modelsapproximately_sized_range only if

      • ranges::reserve_hint(t)
      • ifranges::iterator_t<T> modelsforward_iterator,ranges::reserve_hint(t) is well-defined regardless of the evaluation ofranges::begin(t) (in other words, a single-pass approximately sized range may support a call toreserve_hint only before the first call tobegin, but a forward range must support size at all times).

      [edit]Notes

      Feature-test macroValueStdFeature
      __cpp_lib_ranges_reserve_hint202502L(C++26)ranges::approximately_sized_range

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      specifies that a range knows its size in constant time
      (concept)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/approximately_sized_range&oldid=182368"

      [8]ページ先頭

      ©2009-2025 Movatter.jp