Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-03-07 21:39:27


"Alberto Barbati" <abarbati_at_[hidden]> wrote in message
news:c2gk5o$6v4$1_at_sea.gmane.org...
> Jan Gaspar wrote:
> > I agree the assignment is more efficient. If you dig
> > in the code little bit you will find that there is
> > assignment operation provided for the primitive types.
>
> That is good. However, I think that such optimization is unnecessary.
> For primitive types, the destructor is trivial and the copy constructor
> is the assignment, so I bet a reasonably good compiler can optimize the
> dtor/ctor idiom to a simple assigment even without any "help" in the
> form of template machinery. Besides, bad compilers may introduce
> pessimizations... ;)

The cases where a call to a destructor is actually important beacuse it does
some
non-trivial work, one really need
to ensure not even temporary objects of the type exists. That's one of the
capabilities my smart containers will allow, ie, "overwriting" really means
destructing and replacing.

br

Thorsten


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