A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../ranges/../iterator/readable_traits.html below:

std::indirectly_readable_traits - cppreference.com

template< class I >
struct indirectly_readable_traits {};

(1) (since C++20) template< class T >

struct indirectly_readable_traits<T*> :

    /* cond-value-type */<T> {};
(2) (since C++20) (3) (since C++20) template< class T >

struct indirectly_readable_traits<const T> :

    indirectly_readable_traits<T> {};
(4) (since C++20) template< /* has-member-value-type */ T >

struct indirectly_readable_traits<T> :

    /* cond-value-type */<typename T::value_type> {};
(5) (since C++20) template< /* has-member-element-type */ T >

struct indirectly_readable_traits<T> :

    /* cond-value-type */<typename T::element_type> {};
(6) (since C++20) template< /* has-member-value-type */ T >

    requires /* has-member-element-type */<T>

struct indirectly_readable_traits<T> {};
(7) (since C++20) template< /* has-member-value-type */ T >

    requires /* has-member-element-type */<T> &&
             std::same_as<std::remove_cv_t<typename T::element_type>,
                          std::remove_cv_t<typename T::value_type>>
struct indirectly_readable_traits<T> :

    /* cond-value-type */<typename T::value_type> {};
(8) (since C++20)

Helper classes and concepts

template< class >
struct /* cond-value-type */ {};

(1) (exposition only*) (2) (exposition only*) template< class T >

concept /* has-member-value-type */ =

    requires { typename T::value_type; };
(3) (exposition only*) template< class T >

concept /* has-member-element-type */ =

    requires { typename T::element_type; };
(4) (exposition only*)

Computes the associated value type of the template argument. If the associated value type exists, it is represented by the nested type value_type, otherwise value_type is not defined. A program may specialize indirectly_readable_traits for a program-defined type.

[edit] Explanation

The specializations above can be informally described as below.

Given a type T, its associated value type V is determined as follows:

  • If these types are the same (not considering cv-qualification), C is typename T::value_type.
  • Otherwise, C is undefined.
Then V is determined from C as follows:
[edit] Notes

value_type is intended for use with indirectly_readable types such as iterators. It is not intended for use with ranges.

[edit] Example [edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior LWG 3446 C++20 specializations (5,6) were ambiguous for types having
both value_type and element_type nested types added specialization (8) LWG 3541 C++20 LWG 3446 introduced hard error for ambiguous cases
that value_type and element_type are different added specialization (7) [edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4