This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding moving to basic_string


On Tue, May 17, 2005 at 04:11:30PM +0200, Paolo Carlini wrote:

> Jonathan Wakely wrote:
> 
> >Move semantics could make it as efficient as this (but less ugly):
> >
> >a = ((b+c) += d);
> >  
> >
> Humm, maybe now I see your *real* point ;)
> 
> We arrive in both cases to the above situation. Then things are
> completely different. In the move-semantics + short-string optimization
> case, we can often spare reallocating (b+c) (if there is sufficient
> space available for d too) but then the final assignment is expensive.
> In the reference-counted case b+c is technically shared, unfortunately,
> and will be always reallocated *during* operator+=; then the final
> assignment is cheap.

yes, that's what I was trying to say  :)

jon

-- 
If one tells the truth, one is sure, sooner or later, to be found out.
	- Oscar Wilde


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]