How do you determine the size of an object in C++?

前端 未结 11 1015
轮回少年
轮回少年 2020-11-28 05:38

For example, say I have a class Temp:

class Temp
{
    public:
        int function1(int foo) { return 1; }
        void function2(int bar) { foobar = bar; }         


        
11条回答
  •  情书的邮戳
    2020-11-28 06:15

    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

提交回复
热议问题