Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-04-27 21:17:25


"Beman Dawes" <bdawes_at_[hidden]> writes:

> "Gennadiy Rozental" <gennadiy.rozental_at_[hidden]> wrote in message
> news:d4ooik$f0h$1_at_sea.gmane.org...
>>
>>> you're analogy with vector<string> don't quite fit IMO. assigning
>>> vector<string> might be quite efficient with very few
>>> heap-allocations taking place; assigning ptr_vector<Foo> would cost the
>>> same
>>> as copy-construction + deallocation.
>>
>> IMO no performance point could justify omitting assignment operator. If I
>> need vector<ptr_vector<Foo> > - it's my decision and I will deal with
>> performance penalties.
>
> I agree very much with Gennadiy and others who argue that performance
> concerns should not cause an otherwise useful operation to be omitted.

In this case, the operation is not omitted at all, it's just spelled
in a way that's incompatible with most of the rest of C++, in order to
make certain things very inconvenient (i.e. "force you to think about
the cost of copying"). That's what makes it so frustrating. Contrary
to Peter, I have no serious problem with the idea that some achievable
but poorly performing operations (e.g. operator + on a bidirectional
iterator) might be omitted. I have a big problem with the idea that a
function as basic as copy construction should be made available, but
only with a nonstandard spelling.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk