[libcxx-commits] [libcxx] [libc++][ranges] Implement `ranges::stride_view`. (PR #65200)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 6 05:58:35 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 1cd14adb258da5dc544ca851bb28713a7d576bd6 606879feef119de1edd7936f7a05f0bbb0b11917 -- libcxx/include/__ranges/stride_view.h libcxx/test/libcxx/ranges/range.adaptors/range.stride.view/ctor.assert.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/adaptor.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/base.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/begin.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/ctad.compile.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/ctor.default.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/enable_borrowed_range.compile.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/end.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/iterator/ctor.default.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/iterator/equal.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/sentinel/ctor.default.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/sentinel/equal.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/size.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/stride.pass.cpp libcxx/test/std/ranges/range.adaptors/range.stride.view/test.h libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/test/std/ranges/range.adaptors/range.stride.view/base.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.stride.view/base.pass.cpp
index 6b22b7e89c01..4d06840ff7f8 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.stride.view/base.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.stride.view/base.pass.cpp
@@ -45,7 +45,8 @@ constexpr bool test() {
   // Check the && overload (again)
   {
     InstrumentedBasicView range(buff, buff + 8);
-    std::same_as<InstrumentedBasicView<int>> decltype(auto) result = std::ranges::stride_view<InstrumentedBasicView<int>>(range, 3).base();
+    std::same_as<InstrumentedBasicView<int>> decltype(auto) result =
+        std::ranges::stride_view<InstrumentedBasicView<int>>(range, 3).base();
     assert(result.wasMoveInitialized);
     assert(result.begin() == buff);
     assert(result.end() == buff + 8);
diff --git a/libcxx/test/std/ranges/range.adaptors/range.stride.view/ctad.compile.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.stride.view/ctad.compile.pass.cpp
index 7831d792d64e..ab8768502b1d 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.stride.view/ctad.compile.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.stride.view/ctad.compile.pass.cpp
@@ -23,24 +23,15 @@ constexpr bool test() {
   InstrumentedBasicView<int> bv{arr, arr + 3};
   InstrumentedBasicRange<int> br{};
 
-  static_assert(std::same_as<
-      decltype(std::ranges::stride_view(bv, 2)),
-      std::ranges::stride_view<decltype(bv)>
-  >);
-  static_assert(std::same_as<
-      decltype(std::ranges::stride_view(std::move(bv), 2)),
-      std::ranges::stride_view<decltype(bv)>
-  >);
-
-  static_assert(std::same_as<
-      decltype(std::ranges::drop_view(br, 0)),
-      std::ranges::drop_view<std::ranges::ref_view<InstrumentedBasicRange<int>>>
-  >);
-
-  static_assert(std::same_as<
-      decltype(std::ranges::drop_view(std::move(br), 0)),
-      std::ranges::drop_view<std::ranges::owning_view<InstrumentedBasicRange<int>>>
-  >);
+  static_assert(std::same_as< decltype(std::ranges::stride_view(bv, 2)), std::ranges::stride_view<decltype(bv)> >);
+  static_assert(
+      std::same_as< decltype(std::ranges::stride_view(std::move(bv), 2)), std::ranges::stride_view<decltype(bv)> >);
+
+  static_assert(std::same_as< decltype(std::ranges::drop_view(br, 0)),
+                              std::ranges::drop_view<std::ranges::ref_view<InstrumentedBasicRange<int>>> >);
+
+  static_assert(std::same_as< decltype(std::ranges::drop_view(std::move(br), 0)),
+                              std::ranges::drop_view<std::ranges::owning_view<InstrumentedBasicRange<int>>> >);
   return true;
 }
 
@@ -50,4 +41,3 @@ int main(int, char**) {
 
   return 0;
 }
-

``````````

</details>


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


More information about the libcxx-commits mailing list