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


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

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-05 17:40 -0800
Organization http://groups.google.com
Message-ID <33109983.2179.1328492401830.JavaMail.geo-discussion-forums@prj1> (permalink)
References <cb752c72-5b76-40e5-945f-cfd726b1652d@l16g2000vbl.googlegroups.com>

Show all headers | View raw


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. 

The multi-class inheritance allowed in C++ adds more overheads in any
copy contructor or assignment operations. 

In C the assignment operation allowed in any parensis does not add too much
overhead, since C types are supposed to be register holdables in HW.

But the same teasing trick in C++ is just slowing down some basic operations 
in objects of muti-level multi-class-inherant classes. 

Thus, it requires more skills to write and maintain C++ codes.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next 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