W
want.to.be.professer
#include <iostream>
#include <list>
#include <algorithm>
#include <functional>
using namespace std;
class T
{
public:
static bool IsEqual( int n, int m )
{
return m ==n;
}
static void print ( int n )
{
std::cout << " " << n << std::endl;
}
};
int main()
{
T cT;
int a[10] = {12, 12,23,35, 23,12, 12,23,35, 23};
int* q = std::find_if(a, a + 10, std::bind1st( (&T::IsEqual),
35 ) ); // Error!!!!!!!!!!!!!!!!!!!!!!!!!
for_each( a, a + 10,
&T:rint ); // Work
Fine
//std::cout << "-------" << *q << std::endl;
return 0;
}
But How can I use IsEqual function?
#include <list>
#include <algorithm>
#include <functional>
using namespace std;
class T
{
public:
static bool IsEqual( int n, int m )
{
return m ==n;
}
static void print ( int n )
{
std::cout << " " << n << std::endl;
}
};
int main()
{
T cT;
int a[10] = {12, 12,23,35, 23,12, 12,23,35, 23};
int* q = std::find_if(a, a + 10, std::bind1st( (&T::IsEqual),
35 ) ); // Error!!!!!!!!!!!!!!!!!!!!!!!!!
for_each( a, a + 10,
&T:rint ); // Work
Fine
//std::cout << "-------" << *q << std::endl;
return 0;
}
But How can I use IsEqual function?