Boost logo

Boost Users :

From: Leon Mlakar (leon.mlakar_at_[hidden])
Date: 2007-04-26 04:09:58


> Michael Marcin wrote:
> > That's pretty much what I figured. Also I believe the added inline
> > keyword is redundant as a function defined inside of a class
> > declaration is the same as defining inline after the
> closing semi-colon of the class correct?
>
> Your interpretation is correct, the inline specifier is
> redundant here.
>
> > The copy constructor argument Richard Hadsell mentioned I
> hadn't even
> > considered and it is a good argument in its own right.
>
> I would like to strengthen Richard's remarks: The newly
> proposed class violates the "rule of three", because it
> define's the d'tor, but forget's to implement copy c'tor and
> copy-assignment op (which is, as Richard already said, a bad
> idea here). Astonishingly for an expert...

This really should be emphasized. Having a pointer to dynamically allocated
buffer without custom copy constructor/copy assignment?Sooner or later
somebody will try to copy it ...

The "optimized" code is plainly wrong for the reasons other people already
pointed out.

I can't belive somebody starts optimizing code without first learning the
basics of the language semantics and the libraries used.

Leon


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net