|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-12-23 18:43:47
"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:008f01c3c959$7d58f4c0$1d00a8c0_at_pdimov2...
[snip]
> If you want to demonstrate reuse you need a better example than
>
> for_each( svec.begin(), svec.end(), mem_fn(&Poly::foo) );
> for_each( pvec.begin(), pvec.end(), mem_fn(&Poly::foo) );
>
he he :-) yes, I already stated that the example could be better. Reuse of
functors might be there, but it depends a bit on your needs.
What the example do show is the differnce in declaration and how you would
use push_back. If you have an iterator, you would
see the difference as
vector<Foo*>::iterator i = ..;
ptr_vector<Foo>::iterator ii = ..;
(*i)->foo();
ii->foo();
**i = Foo();
*ii = Foo();
br
Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk