[libcxx-commits] [libcxx] [libc++] Fix {deque, vector}::append_range assuming too much about the types (PR #162438)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 8 07:48:13 PDT 2025


================
@@ -643,6 +643,42 @@ constexpr void test_sequence_assign_range_move_only() {
   c.assign_range(in);
 }
 
+struct InPlaceOnly {
+  InPlaceOnly(const InPlaceOnly&) = delete;
+  InPlaceOnly(InPlaceOnly&&) = delete;
+  InPlaceOnly& operator=(const InPlaceOnly&) = delete;
+  InPlaceOnly& operator=(InPlaceOnly&&) = delete;
+  constexpr InPlaceOnly() {}
+};
+
+struct MoveConstructOnly {
+  MoveConstructOnly(const MoveConstructOnly&) = delete;
+  MoveConstructOnly& operator=(const MoveConstructOnly&) = delete;
+  MoveConstructOnly& operator=(MoveConstructOnly&&) = delete;
+  constexpr MoveConstructOnly(MoveConstructOnly&&) {}
+  constexpr MoveConstructOnly(const InPlaceOnly&) {}
+};
+
+template <template <class...> class Container>
----------------
ldionne wrote:

And we template on the `EmplaceConstructible` type here. Or we use `if constexpr` and do something different for `vector` from within this function.

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


More information about the libcxx-commits mailing list