Skip to content

Commit cdb52b4

Browse files
committed
fixup! WIP: [libc++][ranges] Implement ranges::stride_view.
Final cleanup of begin tests. Signed-off-by: Will Hawkins <[email protected]>
1 parent 0600fda commit cdb52b4

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

libcxx/test/std/ranges/range.adaptors/range.stride.view/begin.pass.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ concept HasConstBegin = requires(const T& ct) { ct.begin(); };
2525
template <class T>
2626
concept HasBegin = requires(T& t) { t.begin(); };
2727

28-
// _View has const-qualified begin and end methods and
29-
// is _not_ a simple view.
3028
template <class T>
3129
concept HasConstAndNonConstBegin = requires(T& t, const T& ct) {
3230
// The return types for begin are different when this is const or not:
@@ -35,30 +33,26 @@ concept HasConstAndNonConstBegin = requires(T& t, const T& ct) {
3533
requires !std::same_as<decltype(t.begin()), decltype(ct.begin())>;
3634
};
3735

38-
// _View does not have const-qualified begin and end methods and
39-
// is _not_ a simple view.
4036
template <class T>
4137
// There is a begin but it's not const qualified => Only non-const qualified begin.
4238
concept HasOnlyNonConstBegin = HasBegin<T> && !HasConstBegin<T>;
4339

44-
// _View does have const-qualified begin and end methods and
45-
// is a simple view.
4640
template <class T>
4741
// There is a const-qualified begin and there are not both const- and non-const qualified begin => Only const-qualified begin.
4842
concept HasOnlyConstBegin = HasConstBegin<T> && !HasConstAndNonConstBegin<T>;
4943

5044
static_assert(HasOnlyNonConstBegin<std::ranges::stride_view<UnSimpleNoConstCommonView>>);
51-
static_assert(HasOnlyConstBegin<std::ranges::stride_view<BasicTestView<int*, int*>>>);
45+
static_assert(HasOnlyConstBegin<std::ranges::stride_view<SimpleCommonConstView>>);
5246
static_assert(HasConstAndNonConstBegin<std::ranges::stride_view<UnSimpleConstView>>);
5347

5448
constexpr bool test() {
55-
const auto const_basic = UnSimpleConstView();
56-
const auto sv_const_basic = std::ranges::stride_view(const_basic, 1);
57-
static_assert(std::same_as<decltype(*sv_const_basic.begin()), double&>);
49+
const auto unsimple_const_view = UnSimpleConstView();
50+
const auto sv_unsimple_const = std::ranges::stride_view(unsimple_const_view, 1);
51+
static_assert(std::same_as<decltype(*sv_unsimple_const.begin()), double&>);
5852

59-
auto non_const_basic = SimpleCommonConstView();
60-
auto sv_non_const_basic = std::ranges::stride_view(non_const_basic, 1);
61-
static_assert(std::same_as<decltype(*sv_non_const_basic.begin()), int&>);
53+
auto simple_const_view = SimpleCommonConstView();
54+
auto sv_simple_const = std::ranges::stride_view(simple_const_view, 1);
55+
static_assert(std::same_as<decltype(*sv_simple_const.begin()), int&>);
6256

6357
return true;
6458
}

0 commit comments

Comments
 (0)