Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #13816

Re: member function swap vs std::move

From 88888 Dihedral <dihedral88888@googlemail.com>
Newsgroups comp.lang.c++
Subject Re: member function swap vs std::move
Date 2012-02-07 06:02 -0800
Organization http://groups.google.com
Message-ID <12844803.1347.1328623326833.JavaMail.geo-discussion-forums@preh38> (permalink)
References <cb752c72-5b76-40e5-945f-cfd726b1652d@l16g2000vbl.googlegroups.com> <33109983.2179.1328492401830.JavaMail.geo-discussion-forums@prj1> <4f30c28b$0$3095$7b1e8fa0@news.nbl.fi>

Show all headers | View raw


在 2012年2月7日星期二UTC+8下午2时19分55秒,Juha Nieminen写道:
> 88888 Dihedral <dihedral88888@googlemail.com> wrote:
> > If the object in any class was stored as one or more  continuos blocks of memory
> > in the compiled or interpreted executables, then the action of swap of two objects in the same class can be faster than the C++ way. 
> 
>   Your text is quite incoherent.
> 
>   I believe that what you are *trying* to say is that if all objects were
> handled by reference (as they are eg. in Java or Objective-C) rather than
> by value (as in C++), then swapping two objects would be way faster.
> 
>   Except that in this case you wouldn't be swapping the contents of the
> objects, but just the two references. Any third reference would not see
> the swap.

I agree with you. The refefrence scheme in swapping is faster.    

Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

member function swap vs std::move m0shbear <andrey.vul@gmail.com> - 2012-02-05 14:41 -0800
  Re: member function swap vs std::move 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-05 17:40 -0800
    Re: member function swap vs std::move Fabrizio J Bonsignore <syntotic@gmail.com> - 2012-02-05 18:17 -0800
      Re: member function swap vs std::move Fabrizio J Bonsignore <syntotic@gmail.com> - 2012-02-05 18:30 -0800
      Re: member function swap vs std::move 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-05 19:33 -0800
    Re: member function swap vs std::move 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-07 06:02 -0800

csiph-web