foo.cpp: In function 'int main()':
foo.cpp:17:24: error: no matching function for call to 'max(int&, long int&)'
M = max(M, f[j]);
^
In file included from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/char_traits.h:39:0,
from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/ios:40,
from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/ostream:38,
from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/iostream:39,
from foo.cpp:1:
C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
max(const _Tp& __a, const _Tp& __b)
^~~
C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed:
foo.cpp:17:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
M = max(M, f[j]);
^
In file included from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/char_traits.h:39:0,
from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/ios:40,
from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/ostream:38,
from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/iostream:39,
from foo.cpp:1:
C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed:
foo.cpp:17:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
M = max(M, f[j]);
^