Commit 0b7f1e24 by Jonathan Wakely

libstdc++: Fix uses of _M_current in split_view's outer iterator

These direct uses of _M_current should all be __current() so they are
valid when the base type doesn't satisfy the forward_range concept.

	* include/std/ranges (split_view::_OuterIter::__at_end): Use __current
	instead of _M_current.
	(split_view::_OuterIter::operator++): Likewise.
parent b269a014
2020-03-10 Jonathan Wakely <jwakely@redhat.com> 2020-03-10 Jonathan Wakely <jwakely@redhat.com>
* include/std/ranges (split_view::_OuterIter::__at_end): Use __current
instead of _M_current.
(split_view::_OuterIter::operator++): Likewise.
* include/std/ranges (transform_view::_Iterator::__iter_move): Remove. * include/std/ranges (transform_view::_Iterator::__iter_move): Remove.
(transform_view::_Iterator::operator*): Add noexcept-specifier. (transform_view::_Iterator::operator*): Add noexcept-specifier.
(transform_view::_Iterator::iter_move): Inline __iter_move body here. (transform_view::_Iterator::iter_move): Inline __iter_move body here.
......
...@@ -2703,9 +2703,9 @@ namespace views ...@@ -2703,9 +2703,9 @@ namespace views
constexpr bool constexpr bool
__at_end() const __at_end() const
{ return _M_current == ranges::end(_M_parent->_M_base); } { return __current() == ranges::end(_M_parent->_M_base); }
// XXX: [24.7.11.3.1] // [range.split.outer] p1
// Many of the following specifications refer to the notional member // Many of the following specifications refer to the notional member
// current of outer-iterator. current is equivalent to current_ if // current of outer-iterator. current is equivalent to current_ if
// V models forward_range, and parent_->current_ otherwise. // V models forward_range, and parent_->current_ otherwise.
...@@ -2798,21 +2798,21 @@ namespace views ...@@ -2798,21 +2798,21 @@ namespace views
operator++() operator++()
{ {
const auto __end = ranges::end(_M_parent->_M_base); const auto __end = ranges::end(_M_parent->_M_base);
if (_M_current == __end) if (__current() == __end)
return *this; return *this;
const auto [__pbegin, __pend] = subrange{_M_parent->_M_pattern}; const auto [__pbegin, __pend] = subrange{_M_parent->_M_pattern};
if (__pbegin == __pend) if (__pbegin == __pend)
++_M_current; ++__current();
else else
do do
{ {
auto [__b, __p] auto [__b, __p]
= __detail::mismatch(std::move(_M_current), __end, = __detail::mismatch(std::move(__current()), __end,
__pbegin, __pend); __pbegin, __pend);
_M_current = std::move(__b); __current() = std::move(__b);
if (__p == __pend) if (__p == __pend)
break; break;
} while (++_M_current != __end); } while (++__current() != __end);
return *this; return *this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment