//used to convert float to any type.
template<typename _Tp>
static inline _Tp saturate_cast(float v)
{
return _Tp(v);
}
//used to compute pow of float val ,and return the value in any type you want;
template<typename _Tp>
_Tp pow_f(float a)
{
return saturate_cast<_Tp>(a*a); ////compile error: #306 no instance of overloaded function "saturate_cast" matches the argument list
}
int main(void) {
pow_f<int>(3.1f);
return 1;
}
thease codes can compiled in vs2008 ,but cann't compiled in ccsv5.....the error message is showed in red color.