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>2021-04-29 16:42:32 +0300
committerJacques Lucke <jacques@blender.org>2021-04-29 16:42:32 +0300
commit4225a18b35f071ae1ff01c54b475ad396c77febc (patch)
tree4b9be641b022708619f505f58bfabd27a4c49df3 /source/blender/functions/FN_generic_virtual_array.hh
parent41945454f712e6892b4e01e093ceeac13cf71a5c (diff)
Function: add method to create shallow copy of virtual array
Creating a shallow copy is sometimes useful to get a unique ptr for a virtual array when one only has a reference. It shouldn't be used usually, but sometimes its the fastest way to do correct ownership handling.
Diffstat (limited to 'source/blender/functions/FN_generic_virtual_array.hh')
-rw-r--r--source/blender/functions/FN_generic_virtual_array.hh11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/functions/FN_generic_virtual_array.hh b/source/blender/functions/FN_generic_virtual_array.hh
index 848deb6bc04..fba69f30330 100644
--- a/source/blender/functions/FN_generic_virtual_array.hh
+++ b/source/blender/functions/FN_generic_virtual_array.hh
@@ -34,6 +34,12 @@ namespace blender::fn {
template<typename T> class GVArray_Typed;
template<typename T> class GVMutableArray_Typed;
+class GVArray;
+class GVMutableArray;
+
+using GVArrayPtr = std::unique_ptr<GVArray>;
+using GVMutableArrayPtr = std::unique_ptr<GVMutableArray>;
+
/* A generically typed version of `VArray<T>`. */
class GVArray {
protected:
@@ -143,6 +149,8 @@ class GVArray {
return GVArray_Typed<T>(*this);
}
+ GVArrayPtr shallow_copy() const;
+
protected:
virtual void get_impl(const int64_t index, void *r_value) const;
virtual void get_to_uninitialized_impl(const int64_t index, void *r_value) const = 0;
@@ -215,9 +223,6 @@ class GVMutableArray : public GVArray {
virtual void *try_get_internal_mutable_varray_impl();
};
-using GVArrayPtr = std::unique_ptr<GVArray>;
-using GVMutableArrayPtr = std::unique_ptr<GVMutableArray>;
-
class GVArray_For_GSpan : public GVArray {
protected:
const void *data_ = nullptr;