For example, say I have a class Temp:
class Temp { public: int function1(int foo) { return 1; } void function2(int bar) { foobar = bar; }
If you are using Microsoft Visual C++ there is one compiler option that tells you, how large your object actually is: /d1reportSingleClassLayout
It's undocumented except for this video by Lavavej http://channel9.msdn.com/Shows/Going+Deep/C9-Lectures-Stephan-T-Lavavej-Advanced-STL-3-of-n