[PATCH] D47111: <experimental/memory_resource>: Implement monotonic_buffer_resource.

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 28 17:33:54 PDT 2018


EricWF added a comment.

FYI I have a full implementation of this laying around as https://reviews.llvm.org/D27402 (https://reviews.llvm.org/D27402). But I have never taken the time to resolve merge conflicts.
Feel free to steal any of the tests if they're still relevant.



================
Comment at: include/experimental/memory_resource:429
+    size_t __capacity_;
+    size_t __alignment_;
+    size_t __used_;
----------------
I can't imagine we'll need more than 1 byte to represent the alignment.


================
Comment at: include/experimental/memory_resource:474
+protected:
+    void* do_allocate(size_t __bytes, size_t __alignment);
+
----------------
Lets add `override` to these functions.


================
Comment at: src/experimental/memory_resource.cpp:217
+{
+    if (void *result = try_allocate_from_chunk(&__original_, bytes, align)) {
+        return result;
----------------
Drop the braces for conditionals and loops with single statements.


Repository:
  rCXX libc++

https://reviews.llvm.org/D47111





More information about the cfe-commits mailing list