Is it possible to determine the size of a C++ class at compile-time?
I seem to remember a template meta-programming method, but I could be mistaken…
sorry for not being clearer – I want the size to be printed in the build output window
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you really need to to get sizeof(X) in the compiler output, you can use it as a parameter for an incomplete template type: