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
This commit is contained in:
parent
cd516d76b6
commit
0491ba09c2
|
@ -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); },
|
||||
|
|
Loading…
Reference in New Issue