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-07-07 21:32:40 +0300
committerJacques Lucke <jacques@blender.org>2020-07-07 21:32:40 +0300
commitafcb41a0aaafce5b99891487a402d78a337f3809 (patch)
treea5dccd70c13eb06af086b910b9aae310724df927 /source/blender/blenlib
parenteb5fb1741d5e9d5f45a8df4750a4b86ee170ee84 (diff)
BLI: simplify copy constructor of Array
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_array.hh8
1 files changed, 2 insertions, 6 deletions
diff --git a/source/blender/blenlib/BLI_array.hh b/source/blender/blenlib/BLI_array.hh
index 9732f43a268..18f9aad1000 100644
--- a/source/blender/blenlib/BLI_array.hh
+++ b/source/blender/blenlib/BLI_array.hh
@@ -89,7 +89,7 @@ class Array {
/**
* Create a new array that contains copies of all values.
*/
- Array(Span<T> values)
+ Array(Span<T> values, Allocator allocator = {}) : allocator_(allocator)
{
size_ = values.size();
data_ = this->get_buffer_for_size(values.size());
@@ -147,12 +147,8 @@ class Array {
data_ = this->get_buffer_for_size(size);
}
- Array(const Array &other) : allocator_(other.allocator_)
+ Array(const Array &other) : Array(other.as_span(), other.allocator_)
{
- size_ = other.size();
-
- data_ = this->get_buffer_for_size(other.size());
- uninitialized_copy_n(other.data(), size_, data_);
}
Array(Array &&other) noexcept : allocator_(other.allocator_)