[libcxx-commits] [libcxx] [libc++] Refactor some code in monotonic_buffer_resource (PR #117271)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Fri Nov 22 04:39:38 PST 2024


================
@@ -48,9 +47,11 @@ class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI monotonic_buffer_resour
       char* __end_;
       size_t __size_;
     };
-    void* __try_allocate_from_chunk(size_t, size_t);
   };
 
+  template <typename Chunk>
+  _LIBCPP_HIDE_FROM_ABI void* __try_allocate_from_chunk(Chunk& self, size_t bytes, size_t align);
----------------
frederick-vs-ja wrote:

On the "ugliness": Oh, currently non-__ugllified identifiers are introduced in a header. If you want to add some implementation details to a header, the identifiers should be __uglified.

> but this can be easy archieved by add a branch judge cost.

I think the cost would be paid at only build-time - it should be just adding and manually specifying another template argument.

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


More information about the libcxx-commits mailing list