记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:27:18: error: call of overloaded 'max(int&, int&)' is ambiguous
  cout << max(a, b) << endl;
                  ^
foo.cc:7:3: note: candidate: T max(T, T) [with T = int]
 T max(const T a,const T b)
   ^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from foo.cc:2:
/usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]
     max(const _Tp& __a, const _Tp& __b)
     ^
foo.cc:29:46: error: call of overloaded 'max(double&, double&)' is ambiguous
  cout << fixed << setprecision(2) << max(c, d) << endl;
                                              ^
foo.cc:7:3: note: candidate: T max(T, T) [with T = double]
 T max(const T a,const T b)
   ^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from foo.cc:2:
/usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = double]
     max(const _Tp& __a, const _Tp& __b)
     ^

自豪的采用 HydroJudger 进行评测(github.com/hydro-dev/HydroJudger)

信息

递交者
类型
递交
题目
P1010 函数模板Swap/Max
语言
C++
递交时间
2020-04-10 19:21:43
评测时间
2020-04-10 19:21:57
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes