SysTutorials

Linux Manual Pages › Section 3

stditer_value_tstditer_reference_tstditer_difference_t(3)

std::iter_value_t,std::iter_reference_t,std::iter_difference_t, - std::iter_value_t,std::iter_reference_t,std::iter_difference_t,

Synopsis

Defined in header <iterator>
template< class T >
concept /*dereferenceable*/ = /* see below */; // exposition only
template< class T >                                                      (1) (since
using iter_value_t = /* see below */;                                        C++20)
template< /*dereferenceable*/ T >                                        (2) (since
using iter_reference_t = decltype(*std::declval<T&>());                      C++20)
template< class T >                                                      (3) (since
using iter_difference_t = /* see below */;                                   C++20)
template< /*dereferenceable*/ T>
requires /* see below */                                                 (4) (since
C++20)
using iter_rvalue_reference_t =
decltype(ranges::iter_move(std::declval<T&>()));
template< Readable T >
using iter_common_reference_t =                                          (5) (since
std::common_reference_t<std::iter_reference_t<T>,                            C++20)
std::iter_value_t<T>&>;

Compute the associated types of an iterator. The exposition-only concept dereferenceable 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<T> is not specialized, then std::iter_value_t<T> is std::readable_traits<T>::value_type. Otherwise, it is std::iterator_traits<T>::value_type. 2) Computes the reference type of T. 3) Computes the difference type of T. If std::iterator_traits<T> is not specialized, then std::iter_difference_t<T> is std::incrementable_traits<T>::difference_type. Otherwise, it is std::iterator_traits<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

Readable             specifies that a type is readable by applying operator *                (concept)                specifies that a Semiregular type can be incremented with pre- WeaklyIncrementable  and post-increment operators                (concept) readable_traits      computes the value type of a Readable type                (class template) incrementable_traits computes the difference type of a WeaklyIncrementable type                (class template) iterator_traits      provides uniform interface to the properties of an iterator                (class template)