diff options
author | Jacques Lucke <jacques@blender.org> | 2020-05-04 12:11:46 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-05-04 12:11:46 +0300 |
commit | 88b9505b8419f4a363e52bb1930cb1946bf327fe (patch) | |
tree | ac9b4c8e430f0f018de0f81e53f9dbd917774e0f /source/blender/blenlib/BLI_array.hh | |
parent | fdebdfa320ec11ddfd6a6319fde86a120769c6f5 (diff) |
BLI: simplify memory management in OpenAddressingArray
Diffstat (limited to 'source/blender/blenlib/BLI_array.hh')
-rw-r--r-- | source/blender/blenlib/BLI_array.hh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_array.hh b/source/blender/blenlib/BLI_array.hh index 61d57599619..9dd8341aa76 100644 --- a/source/blender/blenlib/BLI_array.hh +++ b/source/blender/blenlib/BLI_array.hh @@ -80,7 +80,7 @@ class Array { m_allocator = other.m_allocator; m_data = this->get_buffer_for_size(other.size()); - copy_n(other.begin(), m_size, m_data); + uninitialized_copy_n(other.begin(), m_size, m_data); } Array(Array &&other) noexcept @@ -202,6 +202,11 @@ class Array { return IndexRange(m_size); } + Allocator &allocator() + { + return m_allocator; + } + private: T *get_buffer_for_size(uint size) { |