I want to achieve behavior like sizeof(complete_type) will return real sizeof, and sizeof(incomplete_type) - will be just 0
I need this to provide extended run time type information for IPC(inter-process) communication with the description structure per type:
struct my_type_info
{
bool is_pointer;
size_t size; //for double* will be 4 on i386. that is sizeof(double*)
size_t base_size; //for double* will be 8. that is sizeof(double)
};
The problem appears when into my system goes something like class MyOnlyDeclaredClass; I got compilation error, obviously by reason I can't take size of it.
boost type_traits http://www.boost.org/doc/libs/1_48_0/libs/type_traits/doc/html/index.html suggests many compile-time classes, but there is no 'is_incomplete'
Interesting compilers are VS2008, VS2010, clang 3, gcc-4.6, gcc-4.7