Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::incrementable

      From cppreference.com
      <cpp‎ |iterator
       
       
      Iterator library
      Iterator concepts
      Iterator primitives
      Algorithm concepts and utilities
      Indirect callable concepts
      Common algorithm requirements
      (C++20)
      (C++20)
      (C++20)
      Utilities
      (C++20)
      Iterator adaptors
      Range access
      (C++11)(C++14)
      (C++14)(C++14)  
      (C++11)(C++14)
      (C++14)(C++14)  
      (C++17)(C++20)
      (C++17)
      (C++17)
       
      Defined in header<iterator>
      template<class I>

          concept incrementable=
             std::regular<I>&&
             std::weakly_incrementable<I>&&
              requires(I i){
                 { i++}->std::same_as<I>;

             };
      (since C++20)

      This concept specifies requirements on types that can be incremented with the pre- and post-increment operators, whose increment operations areequality-preserving, and the type isstd::equality_comparable.

      Unlike withstd::weakly_incrementable, which only support single-pass algorithms, multi-pass one-directional algorithms can be used with types that modelstd::incrementable.

      [edit]Semantic requirements

      I modelsstd::incrementable only if given any two incrementable objectsa andb of typeI:

      • bool(a== b) impliesbool(a++== b), and
      • bool(a== b) impliesbool(((void)a++, a)==++b).

      [edit]Equality preservation

      Expressions declared inrequires expressions of the standard library concepts are required to beequality-preserving (except where stated otherwise).

      [edit]See also

      specifies that asemiregular type can be incremented with pre- and post-increment operators
      (concept)[edit]
      (C++20)
      specifies that a type is the same as another type
      (concept)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/iterator/incrementable&oldid=159897"

      [8]ページ先頭

      ©2009-2025 Movatter.jp