Learner's Notes: Alignment and padding - What does [[no_unique_address]] do?
Problem Statement Let’s start with a small, innocent-looking example: struct Foo { long long foo_val; bool foo_val2; }; template struct MaybeDeleted { T val; bool deleted; }; static_assert(sizeof(Foo) == 16); static_assert(alignof(Foo) == 8); static_assert(sizeof(MaybeDeleted) == 24); At first glance, nothing here looks particularly suspi...
评论
?
参与讨论