#include
#include
#include
#include
using namespace std;
class ReplaceFunc
{
int mNumComp;
public:
ReplaceFunc(int i):mNumComp(i){}
bool operator()(int i)
{
if(i==mNumComp)
return true;
else
return false;
}
};
int main()
{
int arr[] = {3, 3, 6, 4, 9, 6, 1, 4, 6, 6, 7, 3};
std::vector vec(arr,arr + sizeof(arr)/sizeof(arr[0]));
cout << "Before\n";
copy(vec.begin(), vec.end(), ostream_iterator(cout, "\n"));
std::replace_if(vec.begin(), vec.end(), ReplaceFunc(3), 54);
cout << "After\n";
copy(vec.begin(), vec.end(), ostream_iterator(cout, "\n"));
return 0;
}