Skip to content

Commit

Permalink
Implement P0738
Browse files Browse the repository at this point in the history
This addresses #35
  • Loading branch information
miscco committed Nov 1, 2019
1 parent b9eb320 commit af4df50
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion stl/inc/iterator
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,26 @@ public:

constexpr istream_iterator() : _Myistr(nullptr), _Myval() {}

istream_iterator(istream_type& _Istr) : _Myistr(_STD addressof(_Istr)) {
istream_iterator(istream_type& _Istr)
#if _HAS_CXX20
: _Myistr(_STD addressof(_Istr)), _Myval() {
#else // _HAS_CXX20
: _Myistr(_STD addressof(_Istr)) {
#endif // _HAS_CXX20
_Getval();
}

_NODISCARD const _Ty& operator*() const {
#if _ITERATOR_DEBUG_LEVEL > 0
_STL_VERIFY(_Myistr, "in_stream must be non null");
#endif // _ITERATOR_DEBUG_LEVEL > 0
return _Myval;
}

_NODISCARD const _Ty* operator->() const {
#if _ITERATOR_DEBUG_LEVEL > 0
_STL_VERIFY(_Myistr, "in_stream must be non null");
#endif // _ITERATOR_DEBUG_LEVEL > 0
return _STD addressof(_Myval);
}

Expand All @@ -164,6 +175,9 @@ public:

protected:
void _Getval() { // get a _Ty value if possible
#if _ITERATOR_DEBUG_LEVEL > 0
_STL_VERIFY(_Myistr, "in_stream must be non null");
#endif // _ITERATOR_DEBUG_LEVEL > 0
if (_Myistr && !(*_Myistr >> _Myval)) {
_Myistr = nullptr;
}
Expand Down
1 change: 1 addition & 0 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
// P0646R1 list/forward_list remove()/remove_if()/unique() Return size_type
// P0653R2 to_address()
// P0655R1 visit<R>()
// P0738R2 istream_iterator Cleanup
// P0758R1 is_nothrow_convertible
// P0768R1 Library Support For The Spaceship Comparison Operator <=>
// (partially implemented)
Expand Down

0 comments on commit af4df50

Please sign in to comment.