Commit: 0491ba09c21a89f3ac32cb93a7800c95aacb0816 Author: Jesse Yurkovich Date: Thu Aug 18 19:40:15 2022 -0700 Branches: master https://developer.blender.org/rB0491ba09c21a89f3ac32cb93a7800c95aacb0816
Cleanup: Remove data duplication from BLI_any.hh support variables Use `inline constexpr` instead of `static constexpr` to prevent these variables from being duplicated in each translation unit that includes the BLI_any.hh header. Differential Revision: https://developer.blender.org/D15698 =================================================================== M source/blender/blenlib/BLI_any.hh =================================================================== diff --git a/source/blender/blenlib/BLI_any.hh b/source/blender/blenlib/BLI_any.hh index a20239f214f..f9b53436763 100644 --- a/source/blender/blenlib/BLI_any.hh +++ b/source/blender/blenlib/BLI_any.hh @@ -39,7 +39,7 @@ template<typename ExtraInfo> struct AnyTypeInfo { * Used when #T is stored directly in the inline buffer of the #Any. */ template<typename ExtraInfo, typename T> -static constexpr AnyTypeInfo<ExtraInfo> info_for_inline = { +inline constexpr AnyTypeInfo<ExtraInfo> info_for_inline = { is_trivially_copy_constructible_extended_v<T> ? nullptr : +[](void *dst, const void *src) { new (dst) T(*(const T *)src); }, @@ -57,7 +57,7 @@ static constexpr AnyTypeInfo<ExtraInfo> info_for_inline = { */ template<typename T> using Ptr = std::unique_ptr<T>; template<typename ExtraInfo, typename T> -static constexpr AnyTypeInfo<ExtraInfo> info_for_unique_ptr = { +inline constexpr AnyTypeInfo<ExtraInfo> info_for_unique_ptr = { [](void *dst, const void *src) { new (dst) Ptr<T>(new T(**(const Ptr<T> *)src)); }, [](void *dst, void *src) { new (dst) Ptr<T>(new T(std::move(**(Ptr<T> *)src))); }, [](void *src) { std::destroy_at((Ptr<T> *)src); }, _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
