2775. reverse_iterator is does not compile for fancy pointers

Section: 27.5.1.3.5 [reverse.iter.opref] Status: Dup Submitter: Billy Robert O'Neal III Opened: 2016-09-23 Last modified: 2017-02-02

Priority: Not Prioritized

View all other issues in [reverse.iter.opref].

View all issues with Dup status.

Duplicate of: 1052

Discussion:

std::reverse_iterator<Iterator>::operator->() is specified to call addressof(operator*()), but it returns iterator_traits<Iterator>::pointer, which may be a fancy pointer type from which no conversion from T* is possible. It should instead delegate to the underlying iterator's operator->().

[Issues processing Telecon 2016-10-7]

Set status to Duplicate

Proposed resolution:

This wording is relative to N4606.

  1. Modify 27.5.1.3.5 [reverse.iter.opref] as indicated:

    constexpr pointer operator->() const;
    

    -1- Returns: addressof(operator*()).Effects: If Iterator is a pointer type, as if by:

    Iterator tmp = current;
    return --tmp;
    

    Otherwise, as if by:

    Iterator tmp = current;
    --tmp;
    return tmp.operator->();