A
alice
When I'm trying to compile the below program on the GPP compiler, it is
giving me errors like
" no match for operator < ..."
Can anybody please help me figure out the error?
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef struct node
{
int i;
int j;
bool operator<(struct node& n1)
{
return (*this.i < n1.i);
}
}node;
int main(void)
{
node data[10];
sort(data,data+10);
return 0;
}
giving me errors like
" no match for operator < ..."
Can anybody please help me figure out the error?
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef struct node
{
int i;
int j;
bool operator<(struct node& n1)
{
return (*this.i < n1.i);
}
}node;
int main(void)
{
node data[10];
sort(data,data+10);
return 0;
}