[libcxx-commits] [libcxx] [libc++][ranges] implement `std::ranges::zip_transform_view` (PR #79605)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 11 11:02:46 PDT 2025
================
@@ -0,0 +1,169 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// Iterator traits and member typedefs in zip_transform_view::iterator.
+
+#include <array>
+#include <ranges>
+
+#include "test_iterators.h"
+
+#include "../types.h"
+
+template <class T>
+concept HasIterCategory = requires { typename T::iterator_category; };
+
+template <class T>
+struct DiffTypeIter {
+ using iterator_category = std::input_iterator_tag;
+ using value_type = int;
+ using difference_type = T;
+
+ int operator*() const;
+ DiffTypeIter& operator++();
+ void operator++(int);
+ friend constexpr bool operator==(DiffTypeIter, DiffTypeIter) = default;
+};
+
+template <class T>
+struct DiffTypeRange {
+ DiffTypeIter<T> begin() const;
+ DiffTypeIter<T> end() const;
+};
+
+struct Foo {};
+struct Bar {};
+
+struct RValueRefFn {
+ int&& operator()(auto&&...) const;
+};
+
+void test() {
+ int buffer[] = {1, 2, 3, 4};
----------------
ldionne wrote:
Do you have a test that there's no `iterator_category` if the underlying range isn't a forward range? https://eel.is/c++draft/range.zip.transform#iterator-1
https://github.com/llvm/llvm-project/pull/79605
More information about the libcxx-commits
mailing list