Created on 2020-10-09.00:00:00 last changed 40 months ago
Proposed resolution:
This wording is relative to N4861.
Modify [range.istream.iterator] as indicated:
iterator& operator++();-2- Preconditions:
-3- Effects: Equivalent to:parent_->stream_ != nullptr*this != default_sentinel is true.*parent_->stream_ >> parent_->object_; return *this;void operator++(int);-4- Preconditions:
-5- Effects: Equivalent to ++*this.parent_->stream_ != nullptr*this != default_sentinel is true.Val& operator*() const;-6- Preconditions:
-7- Effects: Equivalent to: return parent_->object_;parent_->stream_ != nullptr*this != default_sentinel is true.friend bool operator==(const iterator& x, default_sentinel_t);-8- Effects: Equivalent to: return x.parent_ == nullptr || !*x.parent_->stream_;
[ 2021-09-02; Jonathan comments: ]
The preconditions were removed by P2325R3 approved in June 2021.
Although the pointers now cannot be null, it's unclear if we want to require
fail()
to be false for the stream.
[ 2020-10-14; Priority to P3 after reflector discusssion ]
While implementing iranges::stream_view we found some issues with the Preconditions on the member functions of istream_view::iterator, which are superfluous or incorrect.
[range.istream.iterator] p2 reads as:
Preconditions: parent_->stream_ != nullptr is true.
However in the Effects element [range.istream.iterator] p3 it reads:
Effects: Equivalent to:
*parent_->stream_ >> parent_->object_; return *this;
For the Effects element to be valid, we implicitly require that parent_ != nullptr, parent_->stream_ != nullptr and — because we are reading from the underlying stream — !*x.parent_->stream_.
Given that the Preconditions element only mentions one of the three preconditions and essentially means that we are not at the end of the stream, we should replace [range.istream.iterator] p2 by:Preconditions: *this != default_sentinel.
We should use the same precondition for [range.istream.iterator] p4, even if it is implicit via the Effects element in [range.istream.iterator] p5, as that requires experts knowledge of the standard.
The Precondition in [range.istream.iterator] p6 is completely bogus, as accessing the cached object has no dependency on the stream. We assume it is meant that we are not at the end of the stream. Again we should change this to:
Preconditions: *this != default_sentinel.
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-09-02 14:26:14 | admin | set | status: resolved -> new |
2021-09-02 13:20:35 | admin | set | messages: + msg12023 |
2021-09-02 13:20:35 | admin | set | status: new -> resolved |
2020-10-14 22:51:11 | admin | set | messages: + msg11516 |
2020-10-11 12:21:54 | admin | set | messages: + msg11515 |
2020-10-09 00:00:00 | admin | create |