[Bf-blender-cvs] [8cd16b40146] temp-cpp-type-cleanup: better support types without default value
Jacques Lucke
noreply at git.blender.org
Sun Jun 27 17:07:05 CEST 2021
Commit: 8cd16b401467bf874c5f4f80c735cc8b8593125e
Author: Jacques Lucke
Date: Sun Jun 27 15:34:08 2021 +0200
Branches: temp-cpp-type-cleanup
https://developer.blender.org/rB8cd16b401467bf874c5f4f80c735cc8b8593125e
better support types without default value
===================================================================
M source/blender/functions/FN_cpp_type_make.hh
===================================================================
diff --git a/source/blender/functions/FN_cpp_type_make.hh b/source/blender/functions/FN_cpp_type_make.hh
index 8760c49ffe2..7af68f3e23a 100644
--- a/source/blender/functions/FN_cpp_type_make.hh
+++ b/source/blender/functions/FN_cpp_type_make.hh
@@ -190,17 +190,16 @@ template<typename T> inline std::unique_ptr<const CPPType> create_cpp_type(Strin
{
using namespace cpp_type_util;
- static T default_value;
-
CPPTypeMembers m;
m.name = name;
m.size = (int64_t)sizeof(T);
m.alignment = (int64_t)alignof(T);
- m.default_value = (void *)&default_value;
m.is_trivially_destructible = std::is_trivially_destructible_v<T>;
if constexpr (std::is_default_constructible_v<T>) {
m.default_construct = default_construct_cb<T>;
m.default_construct_indices = default_construct_indices_cb<T>;
+ static T default_value;
+ m.default_value = (void *)&default_value;
}
if constexpr (std::is_destructible_v<T>) {
m.destruct = destruct_cb<T>;
More information about the Bf-blender-cvs
mailing list