[clang] [clang-tools-extra] [libcxx] [llvm] [libc++] implement views::concat (PR #120920)

A. Jiang via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 22:57:19 PST 2025


================
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+#include <ranges>
+
+#include <array>
+#include <cassert>
+#include <iterator>
+#include <utility>
+#include "test_iterators.h"
+#include "test_macros.h"
+#include "../types.h"
+
+template <class It>
+concept has_iter_swap = requires(It it) { std::ranges::iter_swap(it, it); };
+
+template <class Iterator, bool IsNoexcept>
+constexpr void test() {
+  using Sentinel       = sentinel_wrapper<Iterator>;
+  using View           = minimal_view<Iterator, Sentinel>;
+  using ConcatView     = std::ranges::concat_view<View>;
+  using ConcatIterator = std::ranges::iterator_t<ConcatView>;
----------------
frederick-vs-ja wrote:

Ditto unused typedef-names.
```suggestion
  using Sentinel   = sentinel_wrapper<Iterator>;
  using View       = minimal_view<Iterator, Sentinel>;
  using ConcatView = std::ranges::concat_view<View>;
```

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


More information about the llvm-commits mailing list