question about C++ STL set
Posted: Tue Sep 06, 2005 4:34 pm
i am trying to make a set of objects of type two and go like this :
i get error message at a.insert(t) which i'm not able to comprehend.... plz give me the correct idea to implement this.
Code: Select all
struct two {
int a,b;
};
int main(){
set<two> a ;
two t;
t.a=1; t.b=3;
a.insert(t);
set<two>::iterator i;
for(i=a.begin() ; i!=a.end() ; i++)
cout << a[i].a << a[i].b ;
return 0;
}