Adding moving to basic_string
Jonathan Wakely
cow@compsoc.man.ac.uk
Tue May 17 12:04:00 GMT 2005
On Tue, May 17, 2005 at 01:52:05PM +0200, Paolo Carlini wrote:
> Jonathan Wakely wrote:
>
> >>Statements like "string s = a + b + c + d;", secondly things like"Return
> >>s" involves copying s, and then immediatly destroying it.
> >>
> >>
> >Doesn't the first case involve several temporary copies even with
> >our ref-counted impl?
> >
> >
> Definitely. There is also something about that in the mentioned papers.
> But, assignments are cheap in the reference-counted case.
Why? An assignment needs to create a new _Rep, even though the left
hand side might be a temporary and therefore a candidate for moving.
(sorry if I'm misunderstanding)
jon
--
"I find television very educating. Every time somebody turns on the set,
I go into the other room and read a book."
- Groucho Marx
More information about the Libstdc++
mailing list