How to get the type of a variable without the "typeinfo" header?
I don't want to link the C++ (not even C's libc) and I want to learn how (and if) I can get the type of a variable for a comparison. For example I want to do something like the following:
Code:
#include <stdio.h>
template <typename T>
void print_type(T num) {
if constexpr(typeof(num) == typeof(double)) {
printf("It is a double!");
} else if constexpr(typeof(num) == typeof(double)) {
printf("It is an integer!"); }
}
Is there any way to do that without using the C++ "typeinfo" header?