customising stl find algorithm
customising stl find algorithm
class tTaskType
{
public:
int data;
bool operator == (int k)
{
if(k ==data)
return true;
else
return false;
}
};
---------------------------------
Main()
tTaskType s1,s2,s3;
s1.data =10;
s2.data =12;
s3.data =13;
list test;
list::iterator Itrtest;
test.push_back(s1);
test.push_back(s2);
test.push_back(s3);
Itrtest =std::find(test.begin(),test.end() ,10) ;
if(Itrtest!=test.end() )
{
printf("Found\n");
}
class tTaskType
{
public:
int data;
bool operator == (int k)
{
if(k ==data)
return true;
else
return false;
}
};
---------------------------------
Main()
tTaskType s1,s2,s3;
s1.data =10;
s2.data =12;
s3.data =13;
list
list
test.push_back(s1);
test.push_back(s2);
test.push_back(s3);
Itrtest =std::find(test.begin(),test.end() ,10) ;
if(Itrtest!=test.end() )
{
printf("Found\n");
}
Comments