[libcxx-commits] [libcxx] [libc++] Implement LWG3918: copy elision in `std::uninitialized_move/_n` (PR #207692)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 7 02:08:48 PDT 2026


================
@@ -56,6 +56,40 @@ int ThrowsCounted::count = 0;
 int ThrowsCounted::constructed = 0;
 int ThrowsCounted::throw_after = 0;
 
+struct NoMoveNoCopy {
+  constexpr explicit NoMoveNoCopy(int x) : value(x) {}
+  NoMoveNoCopy(NoMoveNoCopy const&) { assert(false); }
+  NoMoveNoCopy(NoMoveNoCopy const&&) { assert(false); }
+
+  friend void operator&(NoMoveNoCopy) = delete;
+  int value;
+};
+
+class PrvalueIterator {
+public:
+  using iterator_category = std::input_iterator_tag;
+  using difference_type   = std::ptrdiff_t;
+  using reference         = NoMoveNoCopy;
+  using pointer           = void;
+  using value_type        = NoMoveNoCopy;
+
+  PrvalueIterator() = delete;
+  constexpr PrvalueIterator(const int* ptr) : ptr_(ptr) {}
----------------
inquisitivecrystal wrote:

Done! Thank you for all the review comments, they were very helpful.

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


More information about the libcxx-commits mailing list