Let's say I create 5 objects, all from the same class. Would the byte offset of the first object be 0? How would I find out the byte offset of the other objects?
                
                A: 
                
                
              "Byte offset" from what? Are you creating an array of 5 such objects? In that case, sure, the byte offset of the first one (from the start of the array) is 0; as for other objects,
static_cast<char*>(&thearray[i]) - static_cast<char*>(&thearray[0])
is the byte offset of the ith one.
                  Alex Martelli
                   2010-05-11 03:48:13
                
              You'd either have to reinterpret_cast to char* or add another static_cast through void*.  That said, `i * sizeof thearray[0]` should work just as well since array elements must occupy contiguous storage.
                  James McNellis
                   2010-05-11 03:55:50