alice wrote:
> When I'm trying to compile the below program on the GPP compiler, it
> is giving me errors like
> " no match for operator < ..."
Take a habit not to use '...' in your posts unless absolutely necessary.
>
> Can anybody please help me figure out the error?
>
>
> #include <iostream>
> #include <string>
> #include <algorithm>
>
> using namespace std;
>
> typedef struct node
Drop this C habit. Should just be
struct node
> {
> int i;
> int j;
> bool operator<(struct node& n1)
bool operator<(node const& n1) const
> {
> return (*this.i < n1.i);
> }
> }node;
And remove it here. Should just be
};
>
>
>
> int main(void)
> {
> node data[10];
> sort(data,data+10);
> return 0;
> }
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
|