I am getting "'_comp' cannot be used as a function" error in the stl_algobase.h header file. Here is my code and the part of the header file that is supposed to have the error. code:
#include<iostream>
#include<algorithm>
using namespace std;
void subsqr(int a[10][10]){
//int s[][10];
for(int i =1;i<5;i++){
for(int j = 1;j<5;j++){
if(a[i][j] == 1){
a[i][j] = min(a[i][j-1], a[i-1][j],a[i-1][j-1]) + 1;
}
}
}
for(int i=0;i<5;i++){
for(int j=0;j<5;j++){
cout<<a[i][j]<<"\t";
}
cout<<endl;
}
}
int main(){
int a[10][10] = {{0,1,1,0,1}, {1,1,0,1,0}, {1,1,1,0}, {1,1,1,1,0}, {1,1,1,1,1}, {0,0,0,0,0}};
subsqr(a);
return 0;
}
stl_algobase.h:
template<typename _Tp, typename _Compare>
inline const _Tp&
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
//return __comp(__b, __a) ? __b : __a;
if (__comp(__b, __a))
return __b;
return __a;
}
The compiler says that the error is in the line
if (__comp(__b, __a))