Dekel Tsur <[EMAIL PROTECTED]> writes:

| On Tue, Mar 20, 2001 at 06:18:11PM +0100, Lars Gullik Bjønnes wrote:
| > Depends.... _I_ thing my version is better than your since it operates
| > on iterators, so I don't have to copy the whole vector.
| > This is also why I thing the back_inserter variant is better than the
| > transform solution.
| 
| But when you use a back_inserter, the vector will resize from time to time 
| and the elements will be copied.

That is true. but imho, it is nice to not have to think about the
size. _and_ you are allowed to resize the vector passed to the proxy
also if you _really_ want to avoid the reallocation.
 
| > It is also nice to use std::functors as building stones.
| > 
| > And it also seems that you solution will have to copy the elements in
| > the vector a couple od times more than the other solutions.
| 
| Due to the above, I don't think this is the case.

Depends.

| Anyway, performance issues are probably not very important here.

no, but the resulting code simplicity is.

and by bet is on:

        vector<string> names;
        std::copy(family.begin(), family.end(),
                  back_inserter(push_back_first(names)));

        Lgb

Reply via email to