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

2775. reverse_iterator is does not compile for fancy pointers

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

Priority: Not Prioritized

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

View all issues with Dup status.

Duplicate of: 1052


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 [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;
    return tmp.operator->();