This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

3279. shared_ptr<int>& does not not satisfy readable

Section: [iterator.concept.readable] Status: Resolved Submitter: Eric Niebler Opened: 2019-09-09 Last modified: 2020-09-06

Priority: 1

View all issues with Resolved status.


In the current spec, shared_ptr<int> is readable, but shared_ptr<int>& is not. That is because readable_traits is not stripping top-level references before testing for nested typedefs.

Either readable_traits should see through cv- and ref-qualifiers, or else the readable concept should strip top-level references when building the iter_value_t associated type (e.g., iter_value_t<remove_reference_t<In>>).

Suggest priority P1 because it effects the definition of a concept which cannot change after C++20.

[2019-10 Priority set to 1 after reflector discussion]

[2019-11 This should be resolved by P1878]

Previous resolution [SUPERSEDED]:

This wording is relative to N4830.

  1. Modify [iterator.concept.readable], concept readable synopsis, as indicated:

    template<class In>
      concept readable =
        requires {
          typename iter_value_t<remove_reference_t<In>>;
          typename iter_reference_t<In>;
          typename iter_rvalue_reference_t<In>;
        } &&
        common_reference_with<iter_reference_t<In>&&, iter_value_t<remove_reference_t<In>>&> &&
        common_reference_with<iter_reference_t<In>&&, iter_rvalue_reference_t<In>&&> &&
        common_reference_with<iter_rvalue_reference_t<In>&&, const iter_value_t<remove_reference_t<In>>&>;

[2019-11; Resolved by the adoption of P1878 in Belfast]

Proposed resolution:

Resolved by P1878.