Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cpplearner committed Apr 1, 2022
1 parent ac06653 commit 8958a22
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
17 changes: 10 additions & 7 deletions stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -3050,7 +3050,8 @@ namespace ranges {
private:
struct _Cache_wrapper {
template <input_iterator _Iter>
constexpr _Cache_wrapper(_Not_quite_object::_Construct_tag, const _Iter& _It) noexcept(noexcept(*_It))
constexpr _Cache_wrapper(_Not_quite_object::_Construct_tag, const _Iter& _It) noexcept(
noexcept(static_cast<decltype(_Val)>(*_It)))
: _Val(*_It) {}

remove_cv_t<range_reference_t<_Vw>> _Val;
Expand Down Expand Up @@ -4774,7 +4775,8 @@ namespace ranges {
private:
struct _Cache_wrapper {
template <input_iterator _Iter>
constexpr _Cache_wrapper(_Not_quite_object::_Construct_tag, const _Iter& _It) noexcept(noexcept(*_It))
constexpr _Cache_wrapper(_Not_quite_object::_Construct_tag, const _Iter& _It) noexcept(
noexcept(static_cast<decltype(_Val)>(*_It)))
: _Val(*_It) {}

remove_cv_t<range_reference_t<_Vw>> _Val;
Expand Down Expand Up @@ -4891,7 +4893,7 @@ namespace ranges {
}

constexpr void _Satisfy() {
while (true) {
for (;;) {
if (_Inner_it._Contains == _Variantish_state::_Holds_first) {
if (_Inner_it._First != _RANGES end(_Parent->_Pattern)) {
break;
Expand Down Expand Up @@ -4991,7 +4993,7 @@ namespace ranges {
_Inner_it._Emplace_second(_RANGES end(_Inner));
}

while (true) {
for (;;) {
if (_Inner_it._Contains == _Variantish_state::_Holds_first) {
auto& _It = _Inner_it._First;
if (_It == _RANGES begin(_Parent->_Pattern)) {
Expand Down Expand Up @@ -5034,7 +5036,8 @@ namespace ranges {
return _Tmp;
}

friend constexpr bool operator==(const _Iterator& _Left, const _Iterator& _Right) requires _Deref_is_glvalue
_NODISCARD_FRIEND constexpr bool operator==(
const _Iterator& _Left, const _Iterator& _Right) requires _Deref_is_glvalue
&& equality_comparable<_OuterIter> && equality_comparable<_InnerIter> {
if (_Left._Outer_it != _Right._Outer_it) {
return false;
Expand All @@ -5056,7 +5059,7 @@ namespace ranges {
_STL_UNREACHABLE;
}

friend constexpr decltype(auto) iter_move(const _Iterator& _It) {
_NODISCARD_FRIEND constexpr decltype(auto) iter_move(const _Iterator& _It) {
using _Rvalue_ref =
common_reference_t<iter_rvalue_reference_t<_InnerIter>, iter_rvalue_reference_t<_PatternIter>>;
return _It._Visit_inner_it<_Rvalue_ref>(_RANGES iter_move);
Expand Down Expand Up @@ -5126,7 +5129,7 @@ namespace ranges {

template <bool _OtherConst>
requires sentinel_for<sentinel_t<_Base>, iterator_t<_Maybe_const<_OtherConst, _Vw>>>
_NODISCARD friend constexpr bool operator==(const _Iterator<_OtherConst>& _Left,
_NODISCARD_FRIEND constexpr bool operator==(const _Iterator<_OtherConst>& _Left,
const _Sentinel& _Right) noexcept(noexcept(_Right._Equal(_Left))) /* strengthened */ {
return _Right._Equal(_Left);
}
Expand Down
2 changes: 2 additions & 0 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
// P2166R1 Prohibiting basic_string And basic_string_view Construction From nullptr
// P2186R2 Removing Garbage Collection Support
// P2273R3 constexpr unique_ptr
// P2441R2 views::join_with
// P2443R1 views::chunk_by

// Parallel Algorithms Notes
Expand Down Expand Up @@ -1379,6 +1380,7 @@
#ifdef __cpp_lib_concepts
#define __cpp_lib_out_ptr 202106L
#define __cpp_lib_ranges_chunk_by 202202L
#define __cpp_lib_ranges_join_with 202202L
#define __cpp_lib_ranges_starts_ends_with 202106L
#endif // __cpp_lib_concepts

Expand Down
8 changes: 4 additions & 4 deletions tests/std/tests/P2441R2_views_join_with/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,22 +484,22 @@ void test_valueless_iterator() {
try {
(void) *it2;
assert(false);
} catch (std::bad_variant_access&) {
} catch (bad_variant_access&) {
}
try {
(void) ++it2;
assert(false);
} catch (std::bad_variant_access&) {
} catch (bad_variant_access&) {
}
try {
(void) --it2;
assert(false);
} catch (std::bad_variant_access&) {
} catch (bad_variant_access&) {
}
try {
(void) ranges::iter_move(it2);
assert(false);
} catch (std::bad_variant_access&) {
} catch (bad_variant_access&) {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,20 @@ STATIC_ASSERT(__cpp_lib_ranges_chunk_by == 202202L);
#endif
#endif

#if _HAS_CXX23 && !defined(__EDG__) // TRANSITION, EDG concepts support
#ifndef __cpp_lib_ranges_join_with
#error __cpp_lib_ranges_join_with is not defined
#elif __cpp_lib_ranges_join_with != 202202L
#error __cpp_lib_ranges_join_with is not 202202L
#else
STATIC_ASSERT(__cpp_lib_ranges_join_with == 202202L);
#endif
#else
#ifdef __cpp_lib_ranges_join_with
#error __cpp_lib_ranges_join_with is defined
#endif
#endif

#if _HAS_CXX23 && !defined(__EDG__) // TRANSITION, EDG concepts support
#ifndef __cpp_lib_ranges_starts_ends_with
#error __cpp_lib_ranges_starts_ends_with is not defined
Expand Down

0 comments on commit 8958a22

Please sign in to comment.