Memory usage is quite critical in my application. Therefore I have specific asserts that check for the memory size at compile time and give a static_assert if the size is d
As you discovered, the problem is here (also see this very similar question) :
#define CHECKMEM(mytype, size) #sizeof(mytype)
It is not possible to do, because the stringification is done by the preprocessor, and sizeof is evaluated during the compilation.