Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::incrementable_traits

      From cppreference.com
      <cpp‎ |iterator
       
       
      Iterator library
      Iterator concepts
      Iterator primitives
      (deprecated in C++17)
      incrementable_traits
      (C++20)


      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>
      struct incrementable_traits{};
      (1)(since C++20)
      template<class T>

          requiresstd::is_object_v<T>

      struct incrementable_traits<T*>;
      (2)(since C++20)
      template<class T>

      struct incrementable_traits<const T>

         : incrementable_traits<T>{};
      (3)(since C++20)
      template<class T>

          requires requires{typename T::difference_type;}

      struct incrementable_traits<T>;
      (4)(since C++20)
      template<class T>

          requires(!requires{typename T::difference_type;})&&
                   requires(const T& a,const T& b){{ a- b}->std::integral;}

      struct incrementable_traits<T>;
      (5)(since C++20)

      Computes the associated difference type of the typeI, if any. A program may specializeincrementable_traits for aprogram-defined type.

      1) Primary template is an empty struct.
      2) Specialization for pointers.
      Provides a member typedifference_type same asstd::ptrdiff_t.
      3) Specialization for const-qualified types.
      4) Specialization for types that define a public and accessible member typedifference_type.
      Provides a member typedifference_type same asT::difference_type.
      5) Specialization for types that do not define a public and accessible member typedifference_type but do support subtraction.
      Provides a member typedifference_type same asstd::make_signed_t<decltype(std::declval<T>()-std::declval<T>())>. The implicit expression variations rule (see below) applies to the expressiona- b.

      [edit]Implicit expression variations

      Arequires expression that uses an expression that is non-modifying for some constant lvalue operand also requiresimplicit expression variations.

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      specifies that asemiregular type can be incremented with pre- and post-increment operators
      (concept)[edit]
      computes the associated types of an iterator
      (alias template)[edit]
      provides uniform interface to the properties of an iterator
      (class template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/iterator/incrementable_traits&oldid=170160"

      [8]ページ先頭

      ©2009-2025 Movatter.jp