Victor Bazarov
10/8/2008 7:59:00 PM
puzzlecracker wrote:
> Why do we need mem_fun_ref when we use bind1st or bind2nd functors??
> or even without binders as in example below:
>
> for_each( v2.begin( ), v2.end( ),
> mem_fun_ref ( &NumVals::display ) );
Does that compile, at all?
> cout << endl;
>
'for_each' expects a functor that can be called like so:
F(blah)
.. A member function requires the object. 'mem_fun_ref_t' adapts the
call to itself (it is a functor) to the non-static member function it's
constructed with. What book are you reading that doesn't explain
adapters? Get a copy of Nicolai Josuttis' "The C++ Standard Library".
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask