-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
LWGLibrary Working Group issueLibrary Working Group issuefixedSomething works now, yay!Something works now, yay!rangesC++20/23 rangesC++20/23 ranges
Description
LWG-3880 Clarify operator+= complexity for {chunk,stride}_view::iterator
This appears to be related to #2995 cited in these operators:
Lines 6232 to 6257 in 9ae1b3f
| constexpr _Iterator& operator+=(const difference_type _Off) /* not strengthened, see _RANGES advance */ | |
| requires random_access_range<_Base> | |
| { | |
| if (_Off > 0) { | |
| #if _ITERATOR_DEBUG_LEVEL != 0 | |
| _STL_VERIFY(_Count <= (numeric_limits<difference_type>::max)() / _Off, | |
| "cannot advance chunk_view iterator past end (integer overflow)"); | |
| if constexpr (sized_sentinel_for<_Base_sentinel, _Base_iterator>) { | |
| _STL_VERIFY(_End - _Current > _Count * (_Off - 1), // | |
| "cannot advance chunk_view iterator past end"); | |
| } | |
| #endif // _ITERATOR_DEBUG_LEVEL != 0 | |
| // Per to-be-filed LWG issue (See GH-2995) | |
| if constexpr (sized_sentinel_for<_Base_sentinel, _Base_iterator>) { | |
| _Missing = _RANGES advance(_Current, _Count * _Off, _End); | |
| } else { | |
| _Current += static_cast<difference_type>(_Count * (_Off - 1)); | |
| _Missing = _RANGES advance(_Current, _Count, _End); | |
| } | |
| } else if (_Off < 0) { | |
| _Current += static_cast<difference_type>(_Count * _Off + _Missing); | |
| _Missing = 0; | |
| } | |
| return *this; | |
| } |
Lines 7182 to 7207 in 9ae1b3f
| constexpr _Iterator& operator+=(const difference_type _Off) | |
| requires random_access_range<_Base> | |
| { | |
| if (_Off > 0) { | |
| #if _ITERATOR_DEBUG_LEVEL != 0 | |
| _STL_VERIFY(_Stride <= (numeric_limits<difference_type>::max)() / _Off, | |
| "cannot advance stride_view iterator past end (integer overflow)"); | |
| if constexpr (sized_sentinel_for<_Base_sentinel, _Base_iterator>) { | |
| _STL_VERIFY(_End - _Current > _Stride * (_Off - 1), // | |
| "cannot advance stride_view iterator past end"); | |
| } | |
| #endif // _ITERATOR_DEBUG_LEVEL != 0 | |
| // Per to-be-filed LWG issue (See GH-2995) | |
| if constexpr (sized_sentinel_for<_Base_sentinel, _Base_iterator>) { | |
| _Missing = _RANGES advance(_Current, _Stride * _Off, _End); | |
| } else { | |
| _Current += static_cast<difference_type>(_Stride * (_Off - 1)); | |
| _Missing = _RANGES advance(_Current, _Stride, _End); | |
| } | |
| } else if (_Off < 0) { | |
| _Current += static_cast<difference_type>(_Stride * _Off + _Missing); | |
| _Missing = 0; | |
| } | |
| return *this; | |
| } |
I haven't determined whether we can simply eliminate these comments, or if further changes are required to conform to the resolution of LWG-3880.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
LWGLibrary Working Group issueLibrary Working Group issuefixedSomething works now, yay!Something works now, yay!rangesC++20/23 rangesC++20/23 ranges
Type
Projects
Status
Done