[libcxx-commits] [libcxx] [libc++][memory] P1132R8: `out_ptr` - a scalable output pointer abstraction (PR #73618)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 15 10:40:53 PDT 2024


================
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TEST_LIBCXX_UTILITIES_SMARTPTR_ADAPT_TYPES_H
+#define TEST_LIBCXX_UTILITIES_SMARTPTR_ADAPT_TYPES_H
+
+#include <type_traits>
+#include <memory>
+
+// Custom deleters.
+
+template <typename T>
+struct MoveOnlyDeleter {
+  MoveOnlyDeleter()                                  = default;
+  MoveOnlyDeleter(const MoveOnlyDeleter&)            = delete;
+  MoveOnlyDeleter& operator=(const MoveOnlyDeleter&) = delete;
+  MoveOnlyDeleter(MoveOnlyDeleter&&) : wasMoveInitilized{true} {}
+  MoveOnlyDeleter& operator=(MoveOnlyDeleter&&) = default;
+
+  void operator()(T* p) const { delete p; }
+
+  bool wasMoveInitilized = false;
+};
+
+// Custom pointer types.
+
+template <typename _Tp>
----------------
ldionne wrote:

```suggestion
template <typename T>
```

Here and below. We shouldn't use reserved names in the test suite.

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


More information about the libcxx-commits mailing list