From 892921456310111980 X-Google-Thread: f78e5,516d54c6ff652958 X-Google-Attributes: gidf78e5,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail NNTP-Posting-Date: Thu, 22 Mar 2007 17:40:08 -0500 Return-Path: X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) X-Original-To: std-c++@mailman.ucar.edu Delivered-To: std-c++@mailman.ucar.edu From: "=?iso-8859-1?q?Pedro_Lamar=E3o?=" Newsgroups: comp.std.c++ Subject: Re: "moveable data type" in comparison with "r-value reference" Organization: http://groups.google.com Message-ID: <1174597584.373015.245540@e1g2000hsg.googlegroups.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Complaints-To: groups-abuse@google.com User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: e1g2000hsg.googlegroups.com; posting-host=200.219.129.102; posting-account=IVgBpw0AAABL7eDtnTzNxhVVIQM8Q8Vn X-Virus-Scanned: amavisd-new at ucar.edu X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mulga.csse.unimelb.edu.au id l2ML6Y4I023809 Approved: Fergus Henderson , moderator of comp.std.c++ X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au Date: Thu, 22 Mar 2007 17:34:27 CST Lines: 56 NNTP-Posting-Host: 65.182.171.162 X-Trace: sv3-wayS0tQNDxcAhpwD3mra8NhE5zOTLaGSVBRfsAm8ovdOOF06YGP1f0qqQSpdNfZFA8KmfATITLGA44t!//RCvGWVwnmu3WnaV2c958CLgUmHnYTTZOrzMNPZbdq45tZdPz99sFVAagoNVbpRAlAs3V3TZ676!dt3cZwAWASF+91PRQquLfi1F9K72TAnSDNYNKJV93w== X-Complaints-To: abuse@speakeasy.net X-DMCA-Complaints-To: abuse@speakeasy.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.34 Xref: g2news1.google.com comp.std.c++:8186 On 21 mar, 20:33, grizl...@yandex.ru ("Grizlyk") wrote: > > The state of the source may be unchanged, or it may be radically > > different. The only requirement is that the object remain in a self > > consistent state (all internal invariants are still intact). > > The requirement is theoretically correct, but practically useless one, > because even auto_ptr wrapper has other behaviour. > > Note, it is very important for auto_ptr that its state after "move" became > incorrect and user must not have access to auto_ptr during incorrect state, > because else we can not implement desired behaviour of auto memory > substitution. Observe the implementation of the "pseudo-move constructor" for auto_ptr in current libstdc++ main line: auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { } element_type* release() throw() { element_type* __tmp = _M_ptr; _M_ptr = 0; return __tmp; } After we move from __a it becomes just as if default constructed. So it is not true that move semantics require the moved-from object to have incorrect internal state. > Article "apperance of moveable concept" on my pagehttp://grizlyk1.narod.ru/cpp_new#14_1coming soon. > > > From a client code point of view, choosing move instead of copy means > > that you don't care what happens to the state of the source. > > Here "copying from non-const source" and "move" are mixed. There are > differences beetwen them. For "move" source state _never_ will be correct or > UB, _always_ will be incorrect. This _never_ is artificial. There is no practical requirement for it. This _never_ implies the above implementation of auto_ptr is wrong. It is not. -- Pedro Lamar�o --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]