From a337e7738fbf2ec1eaec4c1deb46d28840885758 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 25 May 2022 16:28:07 +0200 Subject: BLI: use no_unique_address attribute Even though the `no_unique_address` attribute has only been standardized in C++20, compilers seem to support it with C++17 already. This attribute allows reducing the memory footprint of structs which have empty types as data members (usually that is an allocator or inline buffer in Blender). Previously, one had to use the empty base optimization to achieve the same effect, which requires a lot of boilerplate code. The types that benefit from this the most are `Vector` and `Array`, which usually become 8 bytes smaller. All types which use these core data structures get smaller as well of course. Differential Revision: https://developer.blender.org/D14993 --- source/blender/blenlib/BLI_set.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenlib/BLI_set.hh') diff --git a/source/blender/blenlib/BLI_set.hh b/source/blender/blenlib/BLI_set.hh index 99acae43571..62de4b79e41 100644 --- a/source/blender/blenlib/BLI_set.hh +++ b/source/blender/blenlib/BLI_set.hh @@ -136,10 +136,10 @@ class Set { uint64_t slot_mask_; /** This is called to hash incoming keys. */ - Hash hash_; + BLI_NO_UNIQUE_ADDRESS Hash hash_; /** This is called to check equality of two keys. */ - IsEqual is_equal_; + BLI_NO_UNIQUE_ADDRESS IsEqual is_equal_; /** The max load factor is 1/2 = 50% by default. */ #define LOAD_FACTOR 1, 2 -- cgit v1.2.3