Article View: comp.std.c++
Article #3282Re: auto_ptr again
From: Joe Buck
Date: Wed, 07 Feb 1996 23:00
Date: Wed, 07 Feb 1996 23:00
29 lines
2136 bytes
2136 bytes
I wrote: >|> Anyone who writes a class in which X(X&) or X(const X&) does not have the >|> semantics of a copy operation is doing something wrong (e.g. auto_ptr in >|> the draft standard is broken). James Kanze US/ESC 60/3/141 #40763 <kanze@lts.sel.alcatel.de> writes: >I wouldn't go quite that far. X(X&) is a particular form of copy, >which modifies the copied object. If it is programmed in such a way >that the number of intermittent copies is meaningless (as is the case >in auto_ptr), then it is perfectly valid. You're not really disagreeing with me, James. X(X&) is a reasonable thing to do in some cases, and the source object will then be modified, but if this operation does not look like a copy that leaves the functioning of the argument object mostly unaltered, the user of the class is going to have problems and surprises. Many uses of X(X&) just modify private members to keep some sort of internal record, e.g. how many copies there are and connections between them. -- -- Joe Buck <jbuck@synopsys.com> (not speaking for Synopsys, Inc) Work for something because it is good, not just because it stands a chance to succeed. -- Vaclav Havel --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
Technical Details
Message-ID:
<4fbapm$lbk@hermes.synopsys.com>Path:
arc1-ca.pugleaf.net!fido.asd.sgi.com!austernReferences:
<4ebhn5$lgt@bmtlh10.bnr.ca> <4eucnc$hr9@hermes.synopsys.com> <9602051159.AA19131@lts.sel.alcatel.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern From: jbuck@Synopsys.COM (Joe Buck) Newsgroups: comp.std.c++ Subject: Re: auto_ptr again Date: 07 Feb 1996 15:00:06 PST Organization: Synopsys Inc., Mountain View, CA 94043-4033 Approved: austern@isolde.mti.sgi.com Message-ID: <4fbapm$lbk@hermes.synopsys.com> References: <4ebhn5$lgt@bmtlh10.bnr.ca> <4eucnc$hr9@hermes.synopsys.com> <9602051159.AA19131@lts.sel.alcatel.de> NNTP-Posting-Host: isolde.mti.sgi.com X-Original-Date: 7 Feb 1996 22:57:58 GMT X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBMRkvJEy4NqrwXLNJAQHSLgH/VWlR4cVeBTyT/S20MdNIJ1FPm0Re/go1 rcHd5IUykJEpcil1IB/JKPGr9xvXrDITnsBEG/Gfh8urHA1JEENPDw== =rnBV Originator: austern@isolde.mti.sgi.com