[libcxx-commits] [libcxx] [libc++] Update the status for lwg-3120 (PR #116772)
Peng Xie via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 17 17:57:47 PST 2025
================
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++17
+// UNSUPPORTED: availability-pmr-missing
+
+// <memory_resource>
+
+// class monotonic_buffer_resource
+
+#include <memory_resource>
+#include <cassert>
+
+#include "count_new.h"
+#include "test_macros.h"
+
+int main(int, char**) {
+ {
+ {
+ // when init given a next buffer size, after release(), reset/not change next buffer size from initial state
+ constexpr size_t expect_next_buffer_size = 512;
+ std::pmr::monotonic_buffer_resource mr{nullptr, expect_next_buffer_size, std::pmr::new_delete_resource()};
+
+ for (int i = 0; i < 100; ++i) {
+ (void)mr.allocate(1);
+ mr.release();
+ ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkLastNewSizeGe(expect_next_buffer_size));
+ }
+ }
+ {
+ // when init given a buffer. after release(), reset current buffer
----------------
love1angel wrote:
Hi, @philnik777, but here, i just want to check whether the offset of the buffer has been reset after release(). what else should i add here? thanks.
https://github.com/llvm/llvm-project/pull/116772
More information about the libcxx-commits
mailing list