Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-07-09 18:37:47

Looks good. Here are my nits:

+<p>The implementation of these operators requires the compiler to
+implement the NRVO (named return value optimization) correctly to
+prevent creating a temporary object. For compilers that don't support
+the NRVO the code will still work,

Well then the implementation doesn't "require" the NRVO. The implementation
is more efficient if the NRVO is implemented.

+ but there is an alternative
+implementation style which will create fewer objects in this
+case. This alternative implementation style copies one of the
+arguments by value instead of creating a local copy. This has two
+drawbacks: The implementation is no longer symmetric

You need to explain what "symmetric" means. And
why should the user care if the implementation is symmetric?

+ and the operators
+signature differs.

>From what? You have to say.

+ Most users will not care much about this, as the
+asymmetric behaviour will only show up if your class has side-effects
+for copying object,
+like counting the number of object created. The
+signature is not important as long as you don't take a pointer (or
+reference) to the operator. The config system will try to find the
+best implementation for your compiler automatically, but if your code
+relies on the exact symmetry or the operators signature to be as
+documented, you should set
+<code>BOOST_FORCE_SYMMETRIC_OPERATORS</code> in your user-config.</p>

Why not always keep the signature symmetric and make the copy inside the
function when there's no NRVO?

My only other complaint concerns the duplication of the Wrapped1<> class
template in various testing files. Code duplication == bad ;-)


----- Original Message -----
From: "Daniel Frey" <d.frey_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, July 08, 2002 4:46 PM
Subject: Re: [boost] Proposed changes to operators.hpp

> On Mon, 2002-07-08 at 21:48, David Abrahams wrote:
> >
> > From: "Daniel Frey" <d.frey_at_[hidden]>
> >
> > > Here we go...
> > > --=-DwNenIpxReg3GeEMZ2Ao
> > > Content-Type: application/x-gzip
> > > Content-Disposition: attachment; filename=boost_1_28_0.patch.tgz
> > > Content-Transfer-Encoding: base64
> > >
> > >
> >
> > 4
> > OK, that didn't work out too well. Please stick it in the files area.
> Simple rule: If it has a GUI, it doesn't work. Damn mail-clients. :)
> I uploaded the file, it's called boost_1_28_0.patch.tgz, not the best
> name but the file can be removed once it is applied or rejected :-/
> Regards, Daniel
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at