[libcxx-commits] [libcxx] [libc++] Implement `views::join_with` (PR #65536)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 26 07:20:16 PST 2024


================
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <ranges>
+
+// constexpr iterator(iterator<!Const> i)
+//   requires Const && convertible_to<iterator_t<V>, OuterIter> &&
+//            convertible_to<iterator_t<InnerRng>, InnerIter> &&
+//            convertible_to<iterator_t<Pattern>, PatternIter>;
+
+#include <ranges>
+
+#include <cassert>
+#include <vector>
+
+#include "../types.h"
+
+constexpr bool test() {
+  { // Regular conversion from `!Const` to `Const` iterator
+    std::vector<std::vector<int>> vec = {{1, 2}, {3, 4}, {5, 6}};
+    int pattern                       = 0;
+    std::ranges::join_with_view jwv(vec, pattern);
+    auto it = jwv.begin();
+    assert(*it == 1);
+
+    using CIter      = std::ranges::iterator_t<const decltype(jwv)>;
----------------
huixie90 wrote:

Could you please
```cpp
static_assert(!std::is_same_v<Iter, CIter>);
```

I think this test is not testing what it is supposed to test. I suspect `it` and `cit` are both `iterator<true>`

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


More information about the libcxx-commits mailing list