From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,HEADER_SPAM autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-Thread: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-ArrivalTime: 2003-06-19 16:27:26 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uwm.edu!rpi!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 19 Jun 2003 19:29:38 -0400 Organization: AT&T Broadband Sender: cppmods@netlab.cs.rpi.edu Message-ID: References: NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Thu, 19 Jun 2003 17:05:49 GMT X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPvJHXkHMCo9UcraBAQE71wH/Tlvq31sm48I9TVht56VsKoF5EZlzrfSX /CpxjsTcS7KgzNpExpoaR8Y+eIG7DjYvu+yPUT3OyDN4NZr9+1IJQQ== =GZOM Xref: archiver1.google.com comp.lang.ada:39462 comp.lang.c++.moderated:68752 Date: 2003-06-19T19:29:38-04:00 List-Id: > classical idiom in C++ is to copy construct a temporary from the right > hand side (the anonymous object which is created), then swap all of the > fields with the target object, so that the anonymous object has the bit > pattern of the original object, and vice versa. On leaving the >... >Because of the swap, C++ gets by with one finalization less:-). On the What if the object is on a linked list with back pointers so that after the swap the pointers are wrong? Or if it just contains pointers to internal parts of itself? [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]