[libcxx-commits] [libcxx] [llvm] [libc++] Remove `get_temporary_buffer`/`return_temporary_buffer` (PR #100914)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 28 03:32:56 PDT 2024
================
@@ -0,0 +1,122 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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 _LIBCPP___MEMORY_SCOPED_TEMPORARY_BUFFER_H
+#define _LIBCPP___MEMORY_SCOPED_TEMPORARY_BUFFER_H
+
+#include <__config>
+#include <__memory/allocator.h>
+#include <__type_traits/is_constant_evaluated.h>
+#include <cstddef>
+#include <new>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
----------------
philnik777 wrote:
General question: Why don't we just make this an allocation function returning a `pair<unique_ptr, size_t>` with a custom deleter?
Then the interface could be used something like
```
auto [__ptr, __size] = std::__allocator_temporary_buffer();
...
```
https://github.com/llvm/llvm-project/pull/100914
More information about the libcxx-commits
mailing list