2208. std::reverse_iterator should be a literal type

Section: 25.5.1 [reverse.iterators] Status: Resolved Submitter: Jeffrey Yasskin Opened: 2012-10-30 Last modified: 2017-03-12 22:42:08 UTC

Priority: 3

View all other issues in [reverse.iterators].

View all issues with Resolved status.


std::reverse_iterator::reverse_iterator(Iterator) should be constexpr so that other constexpr functions can return reverse_iterators. Of the other methods, the other constructors, base(), operator+, operator-, operator[], and the non-member operators can probably also be constexpr.

operator* cannot be constexpr because it involves an assignment to a member variable. Discussion starting with c++std-lib-33282 indicated that it would be useful to make reverse_iterator a literal type despite this restriction on its use at compile time.

Proposed resolution:

This issue was Resolved by paper P0031R0 adopted at Jacksonville, 2016.