PDA

View Full Version : convert template to int in c++



Vuhelper
06-11-2011, 06:44 PM
All I want is to convert the elem to an ASCII code
and elem maybe of any data type
http://cdn3.dreamincode.net/dreamincode/home/images/refsheets5.png.pagespeed.ce.qyEQxonPyJ.png
C++ Syntax (Toggle Plain Text)


1.
template<typename T>
2.
int h(T elem,int size){
3.
int i;
4.

5.
int n=(int)elem
6.
i=n%size;
7.
return i;