r/cpp • u/meetingcpp Meeting C++ | C++ Evangelist • Sep 24 '26
About alignment, struct layout and the cache...
https://meetingcpp.com/blog/items/About-alignment--struct-layout-and-the-cache---.html
36
Upvotes
View all comments
Show parent comment
2
u/friedkeenan Sep 26 '26
I don't think that's the same as if it has padding bytes. For one, the type also needs to be trivially copyable for it to yield
true, but also a type can have no padding bytes and still not have unique object representations. For instance, for floating-point types, aNaNvalue can be represented by multiple different bitwise representations, and so this trait will yieldfalsefor floats.