Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-06-09 11:10:56 +0300
committerJacques Lucke <jacques@blender.org>2020-06-09 11:15:43 +0300
commitd8678e02ecec9375bec1dcf1388c6fc8b4ce3ad2 (patch)
tree6e7d2a7452091877f73d413d830e6cb12e86745f /source/blender/blenlib/BLI_linear_allocator.hh
parent50258d55e7c1360274d40e303386cf70b16c8b2f (diff)
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
Diffstat (limited to 'source/blender/blenlib/BLI_linear_allocator.hh')
-rw-r--r--source/blender/blenlib/BLI_linear_allocator.hh6
1 files changed, 3 insertions, 3 deletions
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<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya
template<typename T> MutableArrayRef<T> construct_array_copy(ArrayRef<T> src)
{
MutableArrayRef<T> dst = this->allocate_array<T>(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<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya
m_unused_borrowed_buffers.append(ArrayRef<char>((char *)buffer, size));
}
- template<uint Size, uint Alignment>
+ template<size_t Size, size_t Alignment>
void provide_buffer(AlignedBuffer<Size, Alignment> &aligned_buffer)
{
this->provide_buffer(aligned_buffer.ptr(), Size);
@@ -208,7 +208,7 @@ template<typename Allocator = GuardedAllocator> 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;