Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

unnecessary copying

1 view
Skip to first unread message

mattb

unread,
Dec 19, 2009, 9:43:07 AM12/19/09
to
Whilst reading through some old articles on ddj I came across an
article on Mojo by Andrei Alexandrescu. Whilst this describes a
framework for eliminating unnecessary copies it is rather old and
hints at possible future changes to the standard that might address
the problem. I am wondering what the current state of affairs is
concerning this? Any info will be happily consumed...

Cheers,
Matt.

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Nick Hounsome

unread,
Dec 19, 2009, 12:11:20 PM12/19/09
to
On 19 Dec, 14:43, mattb <matthew.b...@l-3com.com> wrote:
> Whilst reading through some old articles on ddj I came across an
> article on Mojo by Andrei Alexandrescu. Whilst this describes a
> framework for eliminating unnecessary copies it is rather old and
> hints at possible future changes to the standard that might address
> the problem. I am wondering what the current state of affairs is
> concerning this? Any info will be happily consumed...

You don't give any reference to the article and I'm not going to
search for it but the unnecessary copy elimination in C++0x probably
refers to rvalue references (like: x&& ) which allow you to implement
copying like swap or like assignment of auto_ptr - i.e. you can
'steal' the content of the source rather than making a new copy.

http://en.wikipedia.org/wiki/C%2B%2B0x#Rvalue_reference_and_move_semantics

mattb

unread,
Dec 21, 2009, 10:01:24 AM12/21/09
to
On Dec 19, 5:11 pm, Nick Hounsome <nick.houns...@googlemail.com>
wrote:

> On 19 Dec, 14:43, mattb <matthew.b...@l-3com.com> wrote:
>
> > Whilst reading through some old articles on ddj I came across an
> > article on Mojo by Andrei Alexandrescu. Whilst this describes a
> > framework for eliminating unnecessary copies it is rather old and
> > hints at possible future changes to the standard that might address
> > the problem. I am wondering what the current state of affairs is
> > concerning this? Any info will be happily consumed...
>
> You don't give any reference to the article and I'm not going to
> search for it but the unnecessary copy elimination in C++0x probably
> refers to rvalue references (like: x&& ) which allow you to implement
> copying like swap or like assignment of auto_ptr - i.e. you can
> 'steal' the content of the source rather than making a new copy.
>
> http://en.wikipedia.org/wiki/C%2B%2B0x#Rvalue_reference_and_move_sema...
>

Sorry, Article was titled 'Move Constructors'. At http://www.ddj.com/cpp/184403855.

Nick Hounsome

unread,
Dec 21, 2009, 7:26:07 PM12/21/09
to
On 21 Dec, 15:01, mattb <matthew.b...@l-3com.com> wrote:
> On Dec 19, 5:11 pm, Nick Hounsome <nick.houns...@googlemail.com>
> wrote:
>
>
>
> > On 19 Dec, 14:43, mattb <matthew.b...@l-3com.com> wrote:
>
> > > Whilst reading through some old articles on ddj I came across an
> > > article on Mojo by Andrei Alexandrescu. Whilst this describes a
> > > framework for eliminating unnecessary copies it is rather old and
> > > hints at possible future changes to the standard that might address
> > > the problem. I am wondering what the current state of affairs is
> > > concerning this? Any info will be happily consumed...
>
> > You don't give any reference to the article and I'm not going to
> > search for it but the unnecessary copy elimination in C++0x probably
> > refers to rvalue references (like: x&& ) which allow you to implement
> > copying like swap or like assignment of auto_ptr - i.e. you can
> > 'steal' the content of the source rather than making a new copy.
>
> >http://en.wikipedia.org/wiki/C%2B%2B0x#Rvalue_reference_and_move_sema...
>
> Sorry, Article was titled 'Move Constructors'. Athttp://www.ddj.com/cpp/184403855.

That is indeed very old.
Forget it.

Move constructors can now be done with rvalue references as I
indicated.
They are implemented in g++ and in visual studio 2010.

Maxim Yegorushkin

unread,
Dec 22, 2009, 12:17:10 AM12/22/09
to
On 19/12/09 14:43, mattb wrote:
> Whilst reading through some old articles on ddj I came across an
> article on Mojo by Andrei Alexandrescu. Whilst this describes a
> framework for eliminating unnecessary copies it is rather old and
> hints at possible future changes to the standard that might address
> the problem. I am wondering what the current state of affairs is
> concerning this? Any info will be happily consumed...

A good series of articles on this subject by Dave Abrahams (start at the
bottom):

http://cpp-next.com/archive/category/value-semantics/

--
Max

0 new messages