Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/iterator/iter t"

From cppreference.com
< cpp‎ | iterator
m (Added Spanish link)
m (See also: P1754R1)
Line 41: Line 41:
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/iterator/dsc Readable}}
+
{{dsc inc | cpp/iterator/dsc indirectly_readable}}
{{dsc inc | cpp/iterator/dsc WeaklyIncrementable}}
+
{{dsc inc | cpp/iterator/dsc weakly_incrementable}}
 
{{dsc inc | cpp/iterator/dsc indirectly_readable_traits}}
 
{{dsc inc | cpp/iterator/dsc indirectly_readable_traits}}
 
{{dsc inc | cpp/iterator/dsc incrementable_traits}}
 
{{dsc inc | cpp/iterator/dsc incrementable_traits}}
Line 48: Line 48:
 
{{dsc end}}
 
{{dsc end}}
  
{{langlinks|es|ja|zh}}
+
{{langlinks|de|es|ja|ru|zh}}

Revision as of 23:59, 24 November 2021

 
 
Iterator library
Iterator concepts
Iterator primitives
iter_value_titer_difference_titer_reference_titer_const_reference_titer_rvalue_reference_titer_common_reference_t
(C++20)(C++20)(C++20)(C++23)(C++20)(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 T >
concept __Referenceable = /* see below */; // exposition only
template< class T >
using iter_value_t = /* see below */;
(1) (since C++20)
template< __Referenceable T >
using iter_reference_t = decltype(*std::declval<T&>());
(2) (since C++20)
template< class T >
using iter_difference_t = /* see below */;
(3) (since C++20)
template< __Referenceable T>

    requires /* see below */

using iter_rvalue_reference_t = decltype(ranges::iter_move(std::declval<T&>()));
(4) (since C++20)
template< std::indirectly_readable T >

using iter_common_reference_t = std::common_reference_t<std::iter_reference_t<T>,

                                                        std::iter_value_t<T>&>;
(5) (since C++20)

Compute the associated types of an iterator. The exposition-only concept __Referenceable is satisfied if and only if the expression *std::declval<T&>() is valid and has a referenceable type (in particular, not void).

1) Computes the value type of T. If std::iterator_traits<std::remove_cvref_t<T>> is not specialized, then std::iter_value_t<T> is std::indirectly_readable_traits<std::remove_cvref_t<T>>::value_type. Otherwise, it is std::iterator_traits<std::remove_cvref_t<T>>::value_type.
2) Computes the reference type of T.
3) Computes the difference type of T. If std::iterator_traits<std::remove_cvref_t<T>> is not specialized, then std::iter_difference_t<T> is std::incrementable_traits<std::remove_cvref_t<T>>::difference_type. Otherwise, it is std::iterator_traits<std::remove_cvref_t<T>>::difference_type.
4) Computes the rvalue reference type of T. The "see below" portion of the constraint on this alias template is satisfied if and only if the expression ranges::iter_move(std::declval<T&>()) is valid and has a referenceable type (in particular, not void).
5) Computes the common reference type of T. This is the common reference type between its reference type and an lvalue reference to its value type.

See also

specifies that a type is indirectly readable by applying operator *
(concept) [edit]
specifies that a semiregular type can be incremented with pre- and post-increment operators
(concept) [edit]
computes the value type of an indirectly_readable type
(class template) [edit]
computes the difference type of a weakly_incrementable type
(class template) [edit]
provides uniform interface to the properties of an iterator
(class template) [edit]