r/programming • • Apr 01 '13

Ten C++11 Features Every C++ Developer Should Use

http://www.codeproject.com/Articles/570638/Ten-Cplusplus11-Features-Every-Cplusplus-Developer
469 Upvotes

283 comments sorted by

View all comments

Show parent comments

4

u/imMute Apr 02 '13

Because its not always the total size but how fields are packed into the structure.

2

u/nascent Apr 02 '13

Unittests?

unittest {
    MyClass mc;
    // Add values to mc...
    auto mcbytes = cast(ubyte[]) mc;
    assert(mcbytes[0] == 4); //...
}