Is it safe to assume that in a non-virtual single-inheritance class hierarchy (with or without templates involved) the base class pointer of children and parent classes are the same? And the first member of the root class is also always at the same location (first implies second, but this is my main concern).
struct parent {
int type_ = 0;
parent(int type):type_(type) {}
};
struct child: parent {
child():parent(1) {}
};
child ch;
printf("parent %p\r\n", &static_cast<parent&>(ch).type_);
printf("child %p\r\n", &static_cast<child&>(ch).type_); // :)
From my C++-fu, common sense and tests it should be but I'm looking for a C++ standard compliant answer to comfort me. :)
PS: See the code on ideone.com.