-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++][NFC] Create and use test-defined simple_view concept #77334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Instead of using a concept defined in the internal implementation, use a definition of the simple_view ranges concept separately defined and included in test code.
@llvm/pr-subscribers-libcxx Author: Will Hawkins (hawkinsw) ChangesInstead of using a concept defined in the internal implementation, use a definition of the simple_view ranges concept separately defined and included in test code. Patch is 34.24 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/77334.diff 14 Files Affected:
diff --git a/libcxx/test/std/ranges/range.adaptors/range.drop/begin.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.drop/begin.pass.cpp
index 8c28769acf7fbf..28ac53c2445d4b 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.drop/begin.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.drop/begin.pass.cpp
@@ -18,6 +18,7 @@
#include "test_macros.h"
#include "test_iterators.h"
+#include "test_range.h"
#include "types.h"
template<class T>
@@ -122,7 +123,7 @@ constexpr bool test() {
{
static_assert(std::ranges::random_access_range<const SimpleView>);
static_assert(std::ranges::sized_range<const SimpleView>);
- LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<SimpleView>);
+ static_assert(simple_view<SimpleView>);
int non_const_calls = 0;
int const_calls = 0;
std::ranges::drop_view dropView(SimpleView{{}, &non_const_calls, &const_calls}, 4);
@@ -137,7 +138,7 @@ constexpr bool test() {
{
static_assert(std::ranges::random_access_range<const NonSimpleView>);
static_assert(std::ranges::sized_range<const NonSimpleView>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<NonSimpleView>);
+ static_assert(!simple_view<NonSimpleView>);
int non_const_calls = 0;
int const_calls = 0;
std::ranges::drop_view dropView(NonSimpleView{{}, &non_const_calls, &const_calls}, 4);
diff --git a/libcxx/test/std/ranges/range.adaptors/range.drop/types.h b/libcxx/test/std/ranges/range.adaptors/range.drop/types.h
index 1fc3f05bf5eaab..ae861bce40f1ec 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.drop/types.h
+++ b/libcxx/test/std/ranges/range.adaptors/range.drop/types.h
@@ -15,21 +15,21 @@
int globalBuff[8];
template <class T>
-struct sentinel {
+struct drop_sentinel {
T* ptr_;
int* num_of_sentinel_cmp_calls;
public:
- friend constexpr bool operator==(sentinel const s, T* const ptr) noexcept {
+ friend constexpr bool operator==(drop_sentinel const s, T* const ptr) noexcept {
++(*s.num_of_sentinel_cmp_calls);
return {s.ptr_ == ptr};
}
- friend constexpr bool operator==(T* const ptr, sentinel const s) noexcept {
+ friend constexpr bool operator==(T* const ptr, drop_sentinel const s) noexcept {
++(*s.num_of_sentinel_cmp_calls);
return {s.ptr_ == ptr};
}
- friend constexpr bool operator!=(sentinel const s, T* const ptr) noexcept { return !(s == ptr); }
- friend constexpr bool operator!=(T* const ptr, sentinel const s) noexcept { return !(s == ptr); }
+ friend constexpr bool operator!=(drop_sentinel const s, T* const ptr) noexcept { return !(s == ptr); }
+ friend constexpr bool operator!=(T* const ptr, drop_sentinel const s) noexcept { return !(s == ptr); }
};
template <bool IsSimple>
@@ -39,9 +39,9 @@ struct MaybeSimpleNonCommonView : std::ranges::view_base {
constexpr std::size_t size() const { return 8; }
constexpr int* begin() { return globalBuff + start_; }
constexpr std::conditional_t<IsSimple, int*, const int*> begin() const { return globalBuff + start_; }
- constexpr sentinel<int> end() { return sentinel<int>{globalBuff + size(), num_of_sentinel_cmp_calls}; }
+ constexpr drop_sentinel<int> end() { return drop_sentinel<int>{globalBuff + size(), num_of_sentinel_cmp_calls}; }
constexpr auto end() const {
- return std::conditional_t<IsSimple, sentinel<int>, sentinel<const int>>{
+ return std::conditional_t<IsSimple, drop_sentinel<int>, drop_sentinel<const int>>{
globalBuff + size(), num_of_sentinel_cmp_calls};
}
};
diff --git a/libcxx/test/std/ranges/range.adaptors/range.elements/types.h b/libcxx/test/std/ranges/range.adaptors/range.elements/types.h
index f1ee165c3cc636..4c4084695ff332 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.elements/types.h
+++ b/libcxx/test/std/ranges/range.adaptors/range.elements/types.h
@@ -58,8 +58,8 @@ using NonSimpleCommonRandomAccessSized = NonSimpleCommon;
static_assert(std::ranges::common_range<Common<true>>);
static_assert(std::ranges::random_access_range<SimpleCommon>);
static_assert(std::ranges::sized_range<SimpleCommon>);
-LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<SimpleCommon>);
-LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<NonSimpleCommon>);
+static_assert(simple_view<SimpleCommon>);
+static_assert(!simple_view<NonSimpleCommon>);
template <bool Simple>
struct NonCommon : TupleBufferView {
@@ -86,8 +86,8 @@ using NonSimpleNonCommon = NonCommon<false>;
static_assert(!std::ranges::common_range<SimpleNonCommon>);
static_assert(std::ranges::random_access_range<SimpleNonCommon>);
static_assert(!std::ranges::sized_range<SimpleNonCommon>);
-LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<SimpleNonCommon>);
-LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<NonSimpleNonCommon>);
+static_assert(simple_view<SimpleNonCommon>);
+static_assert(!simple_view<NonSimpleNonCommon>);
template <class Derived>
struct IterBase {
diff --git a/libcxx/test/std/ranges/range.adaptors/range.join/range.join.sentinel/ctor.other.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.join/range.join.sentinel/ctor.other.pass.cpp
index 5ef3e7416ef10b..fb1e8eb1ebefa6 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.join/range.join.sentinel/ctor.other.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.join/range.join.sentinel/ctor.other.pass.cpp
@@ -15,6 +15,7 @@
#include <ranges>
#include "../types.h"
+#include "test_range.h"
template <class T>
struct convertible_sentinel_wrapper {
@@ -45,7 +46,7 @@ struct ConstConvertibleView : BufferView<BufferView<int*>*> {
static_assert(!std::ranges::common_range<ConstConvertibleView>);
static_assert(std::convertible_to<std::ranges::sentinel_t<ConstConvertibleView>,
std::ranges::sentinel_t<ConstConvertibleView const>>);
-LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<ConstConvertibleView>);
+static_assert(!simple_view<ConstConvertibleView>);
constexpr bool test() {
int buffer[4][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}};
diff --git a/libcxx/test/std/ranges/range.adaptors/range.join/types.h b/libcxx/test/std/ranges/range.adaptors/range.join/types.h
index c1378dc1144b40..175eb316030e9c 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.join/types.h
+++ b/libcxx/test/std/ranges/range.adaptors/range.join/types.h
@@ -16,6 +16,7 @@
#include "test_macros.h"
#include "test_iterators.h"
+#include "test_range.h"
inline int globalBuffer[4][4] = {
{1111, 2222, 3333, 4444},
@@ -239,7 +240,7 @@ using SimpleInputCommonOuter = BufferView<common_input_iterator<Inner*>>;
static_assert(!std::ranges::forward_range<SimpleInputCommonOuter<>>);
static_assert(!std::ranges::bidirectional_range<SimpleInputCommonOuter<>>);
static_assert(std::ranges::common_range<SimpleInputCommonOuter<>>);
-LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<SimpleInputCommonOuter<>>);
+static_assert(simple_view<SimpleInputCommonOuter<>>);
template <class Inner = BufferView<int*>>
using NonSimpleInputCommonOuter = BufferView<common_input_iterator<const Inner*>, common_input_iterator<const Inner*>,
@@ -247,14 +248,14 @@ using NonSimpleInputCommonOuter = BufferView<common_input_iterator<const Inner*>
static_assert(!std::ranges::forward_range<NonSimpleInputCommonOuter<>>);
static_assert(!std::ranges::bidirectional_range<NonSimpleInputCommonOuter<>>);
static_assert(std::ranges::common_range<NonSimpleInputCommonOuter<>>);
-LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<NonSimpleInputCommonOuter<>>);
+static_assert(!simple_view<NonSimpleInputCommonOuter<>>);
template <class Inner = BufferView<int*>>
using SimpleForwardCommonOuter = BufferView<forward_iterator<Inner*>>;
static_assert(std::ranges::forward_range<SimpleForwardCommonOuter<>>);
static_assert(!std::ranges::bidirectional_range<SimpleForwardCommonOuter<>>);
static_assert(std::ranges::common_range<SimpleForwardCommonOuter<>>);
-LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<SimpleForwardCommonOuter<>>);
+static_assert(simple_view<SimpleForwardCommonOuter<>>);
template <class Inner = BufferView<int*>>
using NonSimpleForwardCommonOuter = BufferView<forward_iterator<const Inner*>, forward_iterator<const Inner*>,
@@ -262,14 +263,14 @@ using NonSimpleForwardCommonOuter = BufferView<forward_iterator<const Inner*>, f
static_assert(std::ranges::forward_range<NonSimpleForwardCommonOuter<>>);
static_assert(!std::ranges::bidirectional_range<NonSimpleForwardCommonOuter<>>);
static_assert(std::ranges::common_range<NonSimpleForwardCommonOuter<>>);
-LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<NonSimpleForwardCommonOuter<>>);
+static_assert(!simple_view<NonSimpleForwardCommonOuter<>>);
template <class Inner = BufferView<int*>>
using SimpleForwardNonCommonOuter = BufferView<forward_iterator<Inner*>, sentinel_wrapper<forward_iterator<Inner*>>>;
static_assert(std::ranges::forward_range<SimpleForwardNonCommonOuter<>>);
static_assert(!std::ranges::bidirectional_range<SimpleForwardNonCommonOuter<>>);
static_assert(!std::ranges::common_range<SimpleForwardNonCommonOuter<>>);
-LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<SimpleForwardNonCommonOuter<>>);
+static_assert(simple_view<SimpleForwardNonCommonOuter<>>);
template <class Inner = BufferView<int*>>
using NonSimpleForwardNonCommonOuter =
@@ -278,13 +279,13 @@ using NonSimpleForwardNonCommonOuter =
static_assert(std::ranges::forward_range<NonSimpleForwardNonCommonOuter<>>);
static_assert(!std::ranges::bidirectional_range<NonSimpleForwardNonCommonOuter<>>);
static_assert(!std::ranges::common_range<NonSimpleForwardNonCommonOuter<>>);
-LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<NonSimpleForwardNonCommonOuter<>>);
+static_assert(!simple_view<NonSimpleForwardNonCommonOuter<>>);
template <class Inner = BufferView<int*>>
using BidiCommonOuter = BufferView<bidirectional_iterator<Inner*>>;
static_assert(std::ranges::bidirectional_range<BidiCommonOuter<>>);
static_assert(std::ranges::common_range<BidiCommonOuter<>>);
-LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<BidiCommonOuter<>>);
+static_assert(simple_view<BidiCommonOuter<>>);
// an iterator where its operator* makes a copy of underlying operator*
template <class It>
@@ -349,7 +350,7 @@ struct InnerRValue : Outer {
static_assert(std::ranges::forward_range<InnerRValue<SimpleForwardCommonOuter<>>>);
static_assert(!std::ranges::bidirectional_range<InnerRValue<SimpleForwardCommonOuter<>>>);
static_assert(std::ranges::common_range<InnerRValue<SimpleForwardCommonOuter<>>>);
-LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<InnerRValue<SimpleForwardCommonOuter<>>>);
+static_assert(simple_view<InnerRValue<SimpleForwardCommonOuter<>>>);
static_assert(!std::is_lvalue_reference_v<std::ranges::range_reference_t<InnerRValue<SimpleForwardCommonOuter<>>>>);
struct move_swap_aware_iter {
diff --git a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/begin.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/begin.pass.cpp
index c89da85155d090..113272703d59fd 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/begin.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/begin.pass.cpp
@@ -16,6 +16,7 @@
#include <cassert>
#include <utility>
#include "test_iterators.h"
+#include "test_range.h"
#include "types.h"
template <class View>
@@ -32,8 +33,8 @@ constexpr bool test() {
static_assert(std::ranges::forward_range<V>);
static_assert(std::ranges::forward_range<const V>);
- LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<V>);
- LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<P>);
+ static_assert(simple_view<V>);
+ static_assert(simple_view<P>);
{
std::ranges::lazy_split_view<V, P> v;
@@ -58,8 +59,8 @@ constexpr bool test() {
static_assert(std::ranges::forward_range<V>);
static_assert(std::ranges::forward_range<const V>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<V>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<P>);
+ static_assert(!simple_view<V>);
+ static_assert(!simple_view<P>);
{
std::ranges::lazy_split_view<V, P> v;
@@ -83,8 +84,8 @@ constexpr bool test() {
using P = V;
static_assert(std::ranges::forward_range<V>);
static_assert(!std::ranges::forward_range<const V>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<V>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<P>);
+ static_assert(!simple_view<V>);
+ static_assert(!simple_view<P>);
std::ranges::lazy_split_view<V, P> v;
auto it = v.begin();
@@ -102,8 +103,8 @@ constexpr bool test() {
static_assert(std::ranges::forward_range<V>);
static_assert(std::ranges::forward_range<const V>);
- LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<V>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<P>);
+ static_assert(simple_view<V>);
+ static_assert(!simple_view<P>);
{
std::ranges::lazy_split_view<V, P> v;
diff --git a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/end.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/end.pass.cpp
index 0f5ab62650429a..3e3facc1cbe3da 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/end.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/end.pass.cpp
@@ -16,6 +16,7 @@
#include <cassert>
#include <utility>
#include "test_iterators.h"
+#include "test_range.h"
#include "types.h"
struct ForwardViewCommonIfConst : std::ranges::view_base {
@@ -59,8 +60,8 @@ constexpr bool test() {
static_assert(std::ranges::forward_range<V>);
static_assert(std::ranges::common_range<const V>);
- LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<V>);
- LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<P>);
+ static_assert(simple_view<V>);
+ static_assert(simple_view<P>);
{
std::ranges::lazy_split_view<V, P> v;
@@ -85,8 +86,8 @@ constexpr bool test() {
static_assert(std::ranges::forward_range<V>);
static_assert(std::ranges::common_range<V>);
- LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<V>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<P>);
+ static_assert(simple_view<V>);
+ static_assert(!simple_view<P>);
static_assert(std::ranges::forward_range<const V>);
static_assert(std::ranges::common_range<const V>);
diff --git a/libcxx/test/std/ranges/range.adaptors/range.take.while/types.h b/libcxx/test/std/ranges/range.adaptors/range.take.while/types.h
index b946190d3fd801..8a8119970c582c 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.take.while/types.h
+++ b/libcxx/test/std/ranges/range.adaptors/range.take.while/types.h
@@ -36,7 +36,7 @@ struct SimpleView : IntBufferViewBase {
constexpr int* begin() const { return buffer_; }
constexpr int* end() const { return buffer_ + size_; }
};
-LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<SimpleView>);
+static_assert(simple_view<SimpleView>);
struct ConstNotRange : IntBufferViewBase {
using IntBufferViewBase::IntBufferViewBase;
@@ -54,6 +54,6 @@ struct NonSimple : IntBufferViewBase {
constexpr int* end() { return buffer_ + size_; }
};
static_assert(std::ranges::view<NonSimple>);
-LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<NonSimple>);
+static_assert(!simple_view<NonSimple>);
#endif // TEST_STD_RANGES_RANGE_ADAPTORS_RANGE_TAKE_WHILE_TYPES_H
diff --git a/libcxx/test/std/ranges/range.adaptors/range.take/begin.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.take/begin.pass.cpp
index f2ac62e764d59e..0946542fdca9ed 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.take/begin.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.take/begin.pass.cpp
@@ -69,7 +69,7 @@ constexpr bool test() {
ASSERT_SAME_TYPE(decltype(tv.begin()), std::counted_iterator<int*>);
}
- // __simple_view<V> && sized_range<V> && !size_range<!V>
+ // simple_view<V> && sized_range<V> && !size_range<!V>
{
std::ranges::take_view<NonCommonSimpleView> tv{};
ASSERT_SAME_TYPE(decltype(tv.begin()), std::counted_iterator<int*>);
diff --git a/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/ctor.other.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/ctor.other.pass.cpp
index 9635d9a11988c3..11ad73c313c590 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/ctor.other.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/ctor.other.pass.cpp
@@ -46,7 +46,7 @@ static_assert(std::ranges::random_access_range<NonSimpleNonCommonConvertibleView
static_assert(!std::ranges::sized_range<NonSimpleNonCommonConvertibleView>);
static_assert(std::convertible_to<std::ranges::sentinel_t<NonSimpleNonCommonConvertibleView>,
std::ranges::sentinel_t<NonSimpleNonCommonConvertibleView const>>);
-LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<NonSimpleNonCommonConvertibleView>);
+static_assert(!simple_view<NonSimpleNonCommonConvertibleView>);
constexpr bool test() {
int buffer1[4] = {1, 2, 3, 4};
diff --git a/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/eq.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/eq.pass.cpp
index b42ec78cbb7f08..5db73721108141 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/eq.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/eq.pass.cpp
@@ -67,7 +67,7 @@ constexpr bool test() {
// simple-view: const and non-const have the same iterator/sentinel type
std::ranges::zip_view v{SimpleNonCommon(buffer1), SimpleNonCommon(buffer2), SimpleNonCommon(buffer3)};
static_assert(!std::ranges::common_range<decltype(v)>);
- LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<decltype(v)>);
+ static_assert(simple_view<decltype(v)>);
assert(v.begin() != v.end());
assert(v.begin() + 1 != v.end());
@@ -80,7 +80,7 @@ constexpr bool test() {
// !simple-view: const and non-const have different iterator/sentinel types
std::ranges::zip_view v{NonSimpleNonCommon(buffer1), SimpleNonCommon(buffer2), SimpleNonCommon(buffer3)};
static_assert(!std::ranges::common_range<decltype(v)>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<decltype(v)>);
+ static_assert(!simple_view<decltype(v)>);
assert(v.begin() != v.end());
assert(v.begin() + 4 == v.end());
@@ -105,7 +105,7 @@ constexpr bool test() {
// underlying const/non-const sentinel can be compared with both const/non-const iterator
std::ranges::zip_view v{ComparableView(buffer1), ComparableView(buffer2)};
static_assert(!std::ranges::common_range<decltype(v)>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<decltype(v)>);
+ static_assert(!simple_view<decltype(v)>);
assert(v.begin() != v.end());
assert(v.begin() + 4 == v.end());
@@ -130,7 +130,7 @@ constexpr bool test() {
// underlying const/non-const sentinel cannot be compared with non-const/const iterator
std::ranges::zip_view v{ComparableView(buffer1), ConstIncompatibleView{}};
static_assert(!std::ranges::common_range<decltype(v)>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<decltype(v)>);
+ static_assert(!simple_view<decltype(v)>);
using Iter = std::ranges::iterator_t<decltype(v)>;
using ConstIter = std::ranges::iterator_t<const decltype(v)>;
diff --git a/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/minus.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/minus.pass.cpp
index e46ab4c38d2b6b..be0a7ba5b907ed 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/minus.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.zip/sentinel/minus.pass.cpp
@@ -120,7 +120,7 @@ constexpr bool test() {
// simple-view
std::ranges::zip_view v{ForwardSizedNonCommon(buffer1)};
static_assert(!std::ranges::common_range<decltype(v)>);
- LIBCPP_STATIC_ASSERT(std::ranges::__simple_view<decltype(v)>);
+ static_assert(simple_view<decltype(v)>);
auto it = v.begin();
auto st = v.end();
@@ -159,7 +159,7 @@ constexpr bool test() {
// underlying sentinels cannot subtract underlying const iterators
std::ranges::zip_view v(NonSimpleForwardSizedNonCommon{buffer1});
static_assert(!std::ranges::common_range<decltype(v)>);
- LIBCPP_STATIC_ASSERT(!std::ranges::__simple_view<decltype(v)>);
+ static_assert(!simple_view<decltype(v)>);
using Iter = std::ranges:...
[truncated]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. Not much to go, and I'd like to see this approved by the end of today if possible (merged too, but that's at the whim of CI).
libcxx/test/std/ranges/range.adaptors/range.take/begin.pass.cpp
Outdated
Show resolved
Hide resolved
@@ -82,4 +83,10 @@ using NonBorrowedView = std::ranges::single_view<int>; | |||
static_assert(std::ranges::view<NonBorrowedView>); | |||
static_assert(!std::ranges::borrowed_range<NonBorrowedView>); | |||
|
|||
template <class Range> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep around some kind of static assert to ensure that the test definition of simple_view
doesn't diverge from the libc++ definition with __simple_view
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is a great idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will propose something in the follow up. Sorry for the delay!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know what you think.
Address review feedback.
Please review. Double sorry! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending my one comment. Thanks for taking the initiative on this!
Use existing avenue for testing of the new simple_view concept.
✅ With the latest revision this PR passed the C/C++ code formatter. |
Make clang-format happy.
…7334) Instead of using a concept defined in the internal implementation, use a definition of the simple_view ranges concept separately defined and included in test code.
Instead of using a concept defined in the internal implementation, use a definition of the simple_view ranges concept separately defined and included in test code.