OPessoa Blog

Obtaining size of struct at compile time

Posted on 2015-05-06 00:00:00


How to obtain size of struct at compile time using C++...
#include 



template struct check_size {

	static_assert(!(s % t), "Erro");

};



struct foo

{

	char bla[16];

	int test;

};



struct foo_2 : public foo

{

	int test2;

};



void test(check_size){}

void test(check_size){}
Only tested in VC2013.