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

### 2454. Add `raw_storage_iterator::base()` member

Section: 99 [depr.storage.iterator] Status: C++17 Submitter: Jonathan Wakely Opened: 2014-11-11 Last modified: 2017-07-30

Priority: 0

View all other issues in [depr.storage.iterator].

View all issues with C++17 status.

Discussion:

Eric Niebler pointed out that `raw_storage_iterator` should give access to the `OutputIterator` it wraps.

This helps alleviate the exception-safety issue pointed out in the discussion of LWG 2127, as an exception can be caught and then destructors can be run for the constructed elements in the range `[begin, raw.base())`

[2015-02 Cologne]

NJ: Is this "const" correct [in "base()"]? DK: Yes, we always do that. NJ: And the output iterator is not qualifying in any way? AM/DK: That wouldn't make sense. NJ: OK.

VV: What did LEWG say about this feature request? In other words, why is this a library issue? AM: LEWG/JY thought this wouldn't be a contentious issue.

NJ: I really hope the split of LEWG and LWG will be fixed soon, since it's only wasting time. VV: So you want to spend even more of your time on discussions that LEWG has?

AM: I think this specified correctly. I'm not wild about it. But no longer bothered to stand in its way.

GR: Why do we need to repeat the type in "Returns" even though it's part of the synopsis? AM: Good point, but not worth fixing.

NJ: Why is "`base()`" for `reverse_iterator` commented with "// explicit"? AM: I guess in 1998 that was the only way to say this.

AM: So, it's tentatively ready.

Proposed resolution:

This wording is relative to N4140.

1. Add a new function to the synopsis in [storage.iterator] p1:

   >     namespace std {
   >       template <class OutputIterator, class T>
   >       class raw_storage_iterator
   >         : public iterator<output_iterator_tag,void,void,void,void> {
   >       public:
   >         explicit raw_storage_iterator(OutputIterator x);

   >         raw_storage_iterator<OutputIterator,T>& operator*();
   >         raw_storage_iterator<OutputIterator,T>& operator=(const T& element);
   >         raw_storage_iterator<OutputIterator,T>& operator++();
   >         raw_storage_iterator<OutputIterator,T> operator++(int);
   >         OutputIterator base() const;
   >     };
   >     }

2. Insert the new function and a new paragraph series after p7:

   >     OutputIterator base() const;

   > > -?- Returns: An iterator of type `OutputIterator` that points to the same value as `*this` points to.