STL

Pages: 12
I don't have a compiler handy at the moment, so the above code I gave is uncompiled.
I'm guessing you were getting some compile errors in your code?

Yes , i can feel it i am close to getting it to work :)

For example standard fucntors wit adaptors look something like

cx = count_if (numbers, numbers+6, bind1st(equal_to<int>(),10) );

My code is failing here :

remove_copy_if(myVec.begin(),myVec.end(),myVec2.begin(),bind2nd(mfun,10));

Some how i am unable to get the correct calling mechanism.

1
2
3
4
5
6
7
8
9
class myFun : public binary_function <U&,int,bool>
{
    public :
    bool operator()(U &input,int value)
    {
        return input.data > value;
    }

};


Standard library - here i come!
I think you also need to make both your operator()() const and the "input" parameter
a const reference.
Topic archived. No new replies allowed.
Pages: 12