I have a C++ template function which prints numbers.
It works fine for everything, except when I’m working with data of type char.
I’d like char to be printed as int, but if I cast this explicitly in the template function, then I will lose precision on my float types.
I’d like to be able to say:
template<class T> bob(T a){
cout<<if_char_make_int(a)<<endl;
}
But I’m not sure how to do this, or if it is possible.
Any thoughts?
1 Answer