提交 0786e4e0 编写于 作者: N NePPoi

Fix bug in polymorphic_allocator::deallocate

上级 b8b5ee05
...@@ -636,7 +636,7 @@ class polymorphic_allocator { ...@@ -636,7 +636,7 @@ class polymorphic_allocator {
[[nodiscard]] Tp *allocate(size_t n) { [[nodiscard]] Tp *allocate(size_t n) {
return static_cast<Tp *>(resource()->allocate(n * sizeof(Tp), alignof(Tp))); return static_cast<Tp *>(resource()->allocate(n * sizeof(Tp), alignof(Tp)));
} }
void deallocate(Tp *p, size_t n) { resource()->deallocate(p, n); } void deallocate(Tp *p, size_t n) { resource()->deallocate(p, n * sizeof(Tp)); }
void *allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t)) { void *allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t)) {
return resource()->allocate(nbytes, alignment); return resource()->allocate(nbytes, alignment);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册