c++ template duty overloading
below lines "the c++ programming language"
template<class t > t sqrt(t );
template<class t > complex<t> sqrt(complex<t>);
double sqrt(double);
void f(complex<double> z )
{
s q r t (2 ); // sqrt<int>(int)
sqrt(2.0) ; // sqrt(double)
sqrt(z) ; // sqrt<double>(complex<double>)
}
i dont know since sqrt(z) ; calls sqrt<double>(complex<double>) any physique greatfully explain.
author says, t sqrt<complex<t>> some-more specialized t sqrt <t> nonetheless there seperate chapter template<class t > complex<t> sqrt(complex<t>); since that?
Comments
Post a Comment