[libcxx-commits] [libcxx] [libc++][NFC] Add additional tests for begin/end of std::ranges::take_view (PR #79085)

Will Hawkins via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 8 05:25:13 PDT 2024


================
@@ -69,13 +81,51 @@ 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> && !sized_range<const V>
   {
+    static_assert(simple_view<NonCommonSimpleView>);
+    static_assert(std::ranges::sized_range<NonCommonSimpleView>);
+    static_assert(!std::ranges::sized_range<const NonCommonSimpleView>);
+
     std::ranges::take_view<NonCommonSimpleView> tv{};
     ASSERT_SAME_TYPE(decltype(tv.begin()), std::counted_iterator<int*>);
     ASSERT_SAME_TYPE(decltype(std::as_const(tv).begin()), std::counted_iterator<int*>);
   }
 
+  // non simple-view<V> && !sized_range<V>
+  {
+    static_assert(!simple_view<NonSimpleNonSizedView>);
----------------
hawkinsw wrote:

Great idea!

https://github.com/llvm/llvm-project/pull/79085


More information about the libcxx-commits mailing list