[libcxx-commits] [libcxx] [libc++] LWG3918: copy elision in `std::uninitialized_move/_n` (PR #207692)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 6 18:56:16 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) {}
----------------
frederick-vs-ja wrote:
Nit: It seems more reasonable to me to make this constructor `explicit`.
```suggestion
constexpr explicit PrvalueIterator(const int* ptr) : ptr_(ptr) {}
```
https://github.com/llvm/llvm-project/pull/207692
More information about the libcxx-commits
mailing list