Skip to content

Commit

Permalink
Fix noexcept specification
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Apr 23, 2021
1 parent d4c3384 commit 3e94a79
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -3771,13 +3771,16 @@ namespace ranges {
}

_NODISCARD constexpr decltype(auto) operator*() const
noexcept(noexcept(_STD get<_Index>(*_Current))) /* strengthened */ {
if constexpr (is_reference_v<range_reference_t<_Base>>) {
return _STD get<_Index>(*_Current);
} else {
using _ElemTy = remove_cv_t<tuple_element_t<_Index, range_reference_t<_Base>>>;
return static_cast<_ElemTy>(_STD get<_Index>(*_Current));
}
noexcept(noexcept(_STD get<_Index>(*_Current))) /* strengthened */
requires is_reference_v<range_reference_t<_Base>> {
return _STD get<_Index>(*_Current);
}

_NODISCARD constexpr decltype(auto) operator*() const noexcept(
is_nothrow_move_constructible_v<remove_cv_t<tuple_element_t<_Index, range_reference_t<_Base>>>> //
&& noexcept(_STD get<_Index>(*_Current))) /* strengthened */ {
using _ElemTy = remove_cv_t<tuple_element_t<_Index, range_reference_t<_Base>>>;
return static_cast<_ElemTy>(_STD get<_Index>(*_Current));
}

constexpr _Iterator& operator++() noexcept(noexcept(++_Current)) /* strengthened */ {
Expand Down Expand Up @@ -3840,16 +3843,22 @@ namespace ranges {

_NODISCARD constexpr decltype(auto) operator[](const difference_type _Idx) const
noexcept(noexcept(_STD get<_Index>(*(_Current + _Idx)))) /* strengthened */
requires random_access_range<_Base>&& is_reference_v<range_reference_t<_Base>> {
#if _ITERATOR_DEBUG_LEVEL != 0
_Verify_offset(_Idx);
#endif // _ITERATOR_DEBUG_LEVEL != 0
return _STD get<_Index>(*(_Current + _Idx));
}

_NODISCARD constexpr decltype(auto) operator[](const difference_type _Idx) const noexcept(
is_nothrow_move_constructible_v<remove_cv_t<tuple_element_t<_Index, range_reference_t<_Base>>>> //
&& noexcept(_STD get<_Index>(*(_Current + _Idx)))) /* strengthened */
requires random_access_range<_Base> {
#if _ITERATOR_DEBUG_LEVEL != 0
_Verify_offset(_Idx);
#endif // _ITERATOR_DEBUG_LEVEL != 0
if constexpr (is_reference_v<range_reference_t<_Base>>) {
return _STD get<_Index>(*(_Current + _Idx));
} else {
using _ElemTy = remove_cv_t<tuple_element_t<_Index, range_reference_t<_Base>>>;
return static_cast<_ElemTy>(_STD get<_Index>(*(_Current + _Idx)));
}
using _ElemTy = remove_cv_t<tuple_element_t<_Index, range_reference_t<_Base>>>;
return static_cast<_ElemTy>(_STD get<_Index>(*(_Current + _Idx)));
}

_NODISCARD friend constexpr bool operator==(const _Iterator& _Left, const _Iterator& _Right) noexcept(
Expand Down

0 comments on commit 3e94a79

Please sign in to comment.