[libcxx-commits] [PATCH] D117396: [RFC][libc++] Allow non-copyable OutputIterators.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jan 22 07:43:21 PST 2022


Mordante added inline comments.


================
Comment at: libcxx/test/support/test_iterators.h:35-42
+#if TEST_STD_VER > 17
+    // Starting with C++20 an output_iterator must be movable and doesn't
+    // require copyable.
+    output_iterator(const output_iterator&) = delete;
+    output_iterator(output_iterator&&) = default;
+    output_iterator& operator=(const output_iterator&) = delete;
+    output_iterator& operator=(output_iterator&&) = default;
----------------
Mordante wrote:
> Quuxplusone wrote:
> > This is inconsistent with the tactic we picked for `input_iterator`: We now have a `cpp17_input_iterator<T*>` and a `cpp20_input_iterator<T*>` as two differently named types, and we test them both in C++20 mode.
> > Should we just use this (much simpler) tactic for both `output_iterator` and `input_iterator`?
> > If there's a good reason //not// to use this tactic for `input_iterator`, then, does that same good reason apply to `output_iterator`?
> It depends on whether `Cpp17OutputIterator` is used in C++20? If it is we need a second version. This is a quick test to see what fails.
Actually it seems `Cpp17OutputIterator` is used. The comment for `cpp17_input_iterator` is misleading. The algorithms still use the same requirements as C++17. D117950 renames the current requirements, making the way free to add new C++20 iterator.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117396/new/

https://reviews.llvm.org/D117396



More information about the libcxx-commits mailing list