std::incrementable_traits
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Iterator library
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)(C++20)(C++23)(C++20)(C++20)
(deprecated in C++17)
incrementable_traits
(C++20)
(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++14)
(C++11)
(C++11)
(C++20)(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++23)
(C++23)
(C++23)
(C++23)
(C++23)
(C++11)(C++14)
(C++14)(C++14)
Defined in header
<iterator>
template< class I >
struct incrementable_traits {};
(1)
(since C++20)
struct incrementable_traits {};
template< class T >
(2)
(since C++20)
requires std::is_object_v <T>
template< class T >
(3)
(since C++20)
struct incrementable_traits<const T>
template< class T >
(4)
(since C++20)
requires requires { typename T::difference_type; }
template< class T >
(5)
(since C++20)
requires (!requires { typename T::difference_type; }) &&
requires(const T& a, const T& b) { { a - b } -> std::integral ; }
Computes the associated difference type of the type I
, if any. A program may specialize incrementable_traits
for a program-defined type.
1) Primary template is an empty struct.
2) Specialization for pointers.
Provides a member type
difference_type
same as std::ptrdiff_t .3) Specialization for const-qualified types.
4) Specialization for types that define a public and accessible member type
difference_type
. Provides a member type
difference_type
same as T::difference_type
.5) Specialization for types that do not define a public and accessible member type
difference_type
but do support subtraction. Provides a member type
difference_type
same as std::make_signed_t <decltype(std::declval <T>() - std::declval <T>())>. The implicit expression variations rule (see below) applies to the expression a - b.[edit] Implicit expression variations
A requires expression that uses an expression that is non-modifying for some constant lvalue operand also requires implicit expression variations.
[edit] Example
This section is incomplete
Reason: no example
Reason: no example
[edit] See also
(C++20)
semiregular
type can be incremented with pre- and post-increment operators (concept) [edit]
(C++20)(C++20)(C++23)(C++20)(C++20)(C++20)
(alias template)[edit]