Hi,
I am trying to compile this small piece of caose. But am getting some error.
Can anyone assist in solving this?
// Code Begin //
#include<iostream>
#include<vector>
//#include <algorithm>
using namespace std;
//template <typename ss>
class test /*: public unary_function<int, bool>*/ {
private: int i_;
public:
test(int i): i_(i){}
bool operator()(int a) { cout << a << " i " << i_ << endl; }
};
int main()
{
int a[] = {5,4,3,2,1};
int i =0;
vector<int> vi(a,a+5);
bool t = for_each(vi.begin(), vi.end, test(i)); // line 21
return 0;
}
////// End of Code ////
predicate.cpp: In function 'int main()':
predicate.cpp:21: error: no matching function for call to
'for_each(__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > >, <unresolved overloaded function type>, test)'
-----------------------------------------
I don't <span style="font-weight:bold;font-style:italic;">*mix* </span>well
socially....
but am readily <span
style="font-weight:bold;font-style:italic;">*soluble*</span> with
alcohol...<img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/tsmileys2/32.gif">
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping