From d8678e02ecec9375bec1dcf1388c6fc8b4ce3ad2 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 9 Jun 2020 10:10:56 +0200 Subject: BLI: generally improve C++ data structures The main focus here was to improve the docs significantly. Furthermore, I reimplemented `Set`, `Map` and `VectorSet`. They are now (usually) faster, simpler and more customizable. I also rewrote `Stack` to make it more efficient by avoiding unnecessary copies. Thanks to everyone who helped with constructive feedback. Approved by brecht and sybren. Differential Revision: https://developer.blender.org/D7931 --- source/blender/blenlib/BLI_linear_allocator.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/blenlib/BLI_linear_allocator.hh') diff --git a/source/blender/blenlib/BLI_linear_allocator.hh b/source/blender/blenlib/BLI_linear_allocator.hh index 285af49f500..8b77855bb07 100644 --- a/source/blender/blenlib/BLI_linear_allocator.hh +++ b/source/blender/blenlib/BLI_linear_allocator.hh @@ -130,7 +130,7 @@ template class LinearAllocator : NonCopya template MutableArrayRef construct_array_copy(ArrayRef src) { MutableArrayRef dst = this->allocate_array(src.size()); - uninitialized_copy_n(src.begin(), src.size(), dst.begin()); + uninitialized_copy_n(src.data(), src.size(), dst.data()); return dst; } @@ -186,7 +186,7 @@ template class LinearAllocator : NonCopya m_unused_borrowed_buffers.append(ArrayRef((char *)buffer, size)); } - template + template void provide_buffer(AlignedBuffer &aligned_buffer) { this->provide_buffer(aligned_buffer.ptr(), Size); @@ -208,7 +208,7 @@ template class LinearAllocator : NonCopya uint size_in_bytes = power_of_2_min_u(std::max(min_allocation_size, m_next_min_alloc_size)); m_next_min_alloc_size = size_in_bytes * 2; - void *buffer = m_allocator.allocate(size_in_bytes, __func__); + void *buffer = m_allocator.allocate(size_in_bytes, 8, AT); m_owned_buffers.append(buffer); m_current_begin = (uintptr_t)buffer; m_current_end = m_current_begin + size_in_bytes; -- cgit v1.2.3