Hi,
I'd like to print a line of 'double' or of 'integer' type according to T typename.
I tried to compare T with typeof but to no success.
template <typename T>
void printArray(unsigned int x_sz, unsigned int y_sz, T * arr[], std::string title)
{
double f;
unsigned short int usi;
for (unsigned int i = 0; i != x_sz; ++i) {
for (unsigned int j = 0; j != y_sz; ++j) {
if (T == typeof(f)) {
printf(" %2.2f", arr[i][j]);
} else if (T == typeof(usi)) {
printf(" %2d", arr[i][j]);
}
}
cout << endl;
}
}
How should I do this?