mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Enable IntrusiveList self reference to be optimized out when empty
If a member is an empty class, the standard normally stats that it needs to have a size of at least 1 byte in order to guarantee that the addresses of distinct objects of the same type are always distinct. However as of c++20, we can use [[no_unique_address]] to instruct the compiler that if the member has an empty type, it may optimize it to occupy no space.
This commit is contained in:
parent
0e201fbb42
commit
8e41d96618
Notes:
sideshowbarker
2024-07-18 05:29:42 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/8e41d966187 Pull-request: https://github.com/SerenityOS/serenity/pull/9505 Reviewed-by: https://github.com/alimpfard ✅
1 changed files with 1 additions and 1 deletions
|
@ -187,7 +187,7 @@ private:
|
|||
IntrusiveListStorage<T, Container>* m_storage = nullptr;
|
||||
IntrusiveListNode<T, Container>* m_next = nullptr;
|
||||
IntrusiveListNode<T, Container>* m_prev = nullptr;
|
||||
SelfReferenceIfNeeded<Container, IsRaw> m_self;
|
||||
[[no_unique_address]] SelfReferenceIfNeeded<Container, IsRaw> m_self;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue