#include <complex> #include <iostream> using namespace std; int main(void) { complex<int> z(20, 200); cout << abs<int>(z) << endl; return 0; }
Standard input is empty
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/complex: In function ‘_Tp std::__complex_abs(const std::complex<_Tp>&) [with _Tp = int]’: /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/complex:579: instantiated from ‘_Tp std::abs(const std::complex<_Tp>&) [with _Tp = int]’ prog.cpp:9: instantiated from here /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/complex:558: error: call of overloaded ‘abs(int&)’ is ambiguous /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/cmath:99: note: candidates are: double std::abs(double) /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/cmath:103: note: float std::abs(float) /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/cmath:107: note: long double std::abs(long double) /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/complex:558: error: call of overloaded ‘abs(int&)’ is ambiguous /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/cmath:99: note: candidates are: double std::abs(double) /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/cmath:103: note: float std::abs(float) /usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/cmath:107: note: long double std::abs(long double)
Standard output is empty