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>2022-06-25 20:27:33 +0300
committerJacques Lucke <jacques@blender.org>2022-06-25 20:27:33 +0300
commit22fc0cbd6966c1e46a28038fca8ef59e8ce50660 (patch)
tree0f6bf65b27f60f7f313fa14daefa662eb3e4678e /source/blender/blenlib/BLI_generic_virtual_array.hh
parent3237c6dbe877db1cfbe15e92f6cb267d8a6031ea (diff)
BLI: improve support for trivial virtual arrays
This commits reduces the number of function calls through function pointers in `blender::Any` when the stored type is trivial. Furthermore, this implements marks some classes as trivial, which we know are trivial but the compiler does not (the standard currently says that any class with a virtual destructor is non-trivial). Under some circumstances we know that final child classes are trivial though. This allows for some optimizations. Also see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1077r0.html.
Diffstat (limited to 'source/blender/blenlib/BLI_generic_virtual_array.hh')
-rw-r--r--source/blender/blenlib/BLI_generic_virtual_array.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_generic_virtual_array.hh b/source/blender/blenlib/BLI_generic_virtual_array.hh
index b4bd337805f..95305a0561d 100644
--- a/source/blender/blenlib/BLI_generic_virtual_array.hh
+++ b/source/blender/blenlib/BLI_generic_virtual_array.hh
@@ -600,6 +600,8 @@ class GVArrayImpl_For_GSpan_final final : public GVArrayImpl_For_GSpan {
CommonVArrayInfo common_info() const override;
};
+template<> inline constexpr bool is_trivial_extended_v<GVArrayImpl_For_GSpan_final> = true;
+
/** \} */
/* -------------------------------------------------------------------- */
@@ -638,6 +640,9 @@ class GVArrayImpl_For_SingleValueRef_final final : public GVArrayImpl_For_Single
CommonVArrayInfo common_info() const override;
};
+template<>
+inline constexpr bool is_trivial_extended_v<GVArrayImpl_For_SingleValueRef_final> = true;
+
/** \} */
/* -------------------------------------------------------------------- */