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-04-25 12:51:22 +0300
committerJacques Lucke <jacques@blender.org>2022-04-25 12:51:34 +0300
commita2d32960b4de78f545ce52e92185eefd3c93fde1 (patch)
treed07f2c21566f223bd62731ee06e78984caaa17f5 /source/blender/blenlib/BLI_virtual_array.hh
parentc63d64a2ce3e49188628d54450b751fd764b8a67 (diff)
BLI: optimize constructing new virtual array
Differential Revision: https://developer.blender.org/D14745
Diffstat (limited to 'source/blender/blenlib/BLI_virtual_array.hh')
-rw-r--r--source/blender/blenlib/BLI_virtual_array.hh8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh
index 453ca67b1e0..41a73b45853 100644
--- a/source/blender/blenlib/BLI_virtual_array.hh
+++ b/source/blender/blenlib/BLI_virtual_array.hh
@@ -564,10 +564,9 @@ template<typename T> struct VArrayAnyExtraInfo {
/**
* Gets the virtual array that is stored at the given pointer.
*/
- const VArrayImpl<T> *(*get_varray)(const void *buffer) =
- [](const void *UNUSED(buffer)) -> const VArrayImpl<T> * { return nullptr; };
+ const VArrayImpl<T> *(*get_varray)(const void *buffer);
- template<typename StorageT> static VArrayAnyExtraInfo get()
+ template<typename StorageT> static constexpr VArrayAnyExtraInfo get()
{
/* These are the only allowed types in the #Any. */
static_assert(
@@ -711,6 +710,9 @@ template<typename T> class VArrayCommon {
* null. */
const VArrayImpl<T> *impl_from_storage() const
{
+ if (!storage_.has_value()) {
+ return nullptr;
+ }
return storage_.extra_info().get_varray(storage_.get());
}