I wrote a template function that takes an arbitrary number of types and displays their sizes for the underlying architecture and operating system. However, a function cannot distinguish an alias from a real type, so it is evaluated as if it is real.
However, I want to be able to distinguish between an alias and an inline type at compile time and alternate the output based on this.
func<unsigned int, size_t>();
Output:
Unsigned int is 4 bytes. Unsigned int is 4 bytes.
However, I want the result to be so
Unsigned int is 4 bytes. size_t is an alias for unsigned int.
Of course, this requires that the compiler can distinguish between an alias and an inline type at compile time.
So, is there a way to differentiate the real type and the alias at compile time in any version of C ++?
source share