T
temper3243
Hi,
I want to create a set of cells (where it can be ints or doubles ).
The equatily condition is a.x==b.x and a.y==b.y.
I tried compiling this and it failed. Can someone help me.
#include<set>
#include<cstdio>
#include<iostream>
using namespace std;
struct cell {
int x,y;
};
cell a;
bool myeq(const cell &a,const cell &b)
{
if(a.x==b.x && a.y==b.y)
return true;
return false;
}
int main()
{
set <cell,myeq> s;
s.insert(a);
return 0;
}
I want to create a set of cells (where it can be ints or doubles ).
The equatily condition is a.x==b.x and a.y==b.y.
I tried compiling this and it failed. Can someone help me.
#include<set>
#include<cstdio>
#include<iostream>
using namespace std;
struct cell {
int x,y;
};
cell a;
bool myeq(const cell &a,const cell &b)
{
if(a.x==b.x && a.y==b.y)
return true;
return false;
}
int main()
{
set <cell,myeq> s;
s.insert(a);
return 0;
}