[libcxx-commits] [libcxx] [libc++] Refactor some code in monotonic_buffer_resource (PR #117271)
Peng Xie via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 22 04:14:54 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);
----------------
love1angel wrote:
> Can this be moved to a non-member function defined only in `memory_resource.cpp`?
since struct __chunk_footer is private inside class monotonic_buffer_resource. then i couldn't get scope struct __chunk_footer __initial_descriptor.
but this can be easy archieved by add a branch judge cost. otherwise i can distinguish them by struct size, but this is ugly.
https://github.com/llvm/llvm-project/pull/117271
More information about the libcxx-commits
mailing list