Article View: comp.std.c++
Article #2274Re: auto_ptr: : reset and auto_ptr: :operator=
From: Fergus Henderson
Date: Sun, 22 Oct 1995 02:02
Date: Sun, 22 Oct 1995 02:02
29 lines
1916 bytes
1916 bytes
kuehl@uzwil.rz.uni-konstanz.de (Dietmar Kuehl) writes: >J. Kanze (kanze@gabi-soft.fr) wrote: >: Ideally, perhaps, I would want to have assignment and copy construction >: defined only when the source is a temporary. [...] > >The statement with the temporary gave me the following idea: Using two >classes instead of just one class, it is possible to protect the copy >constructor and the assignment operator while still allowing a function >to return a "safe" object. Yes, you (Dietmar Kuehl), Dag Bruck and I all had much the same idea. But eddy Gorsuch and James Kanze noticed a much simpler way: auto_ptr<T> x(foo.release()); y.reset(foo.release()); This seems to me to be quite adequate. -- Fergus Henderson | "Australia is the richest country in the world, fjh@cs.mu.oz.au | according to a new system of measuring wealth http://www.cs.mu.oz.au/~fjh | announced by the World Bank yesterday." PGP: finger fjh@128.250.37.3 | - Melbourne newspaper "The Age", 18 Sept 1995. --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<9529510.24138@mulga.cs.mu.OZ.AU>Path:
arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-backReferences:
<44oenv$c6i@gabi.gabi-soft.fr> <44so2o$2h0@eurybia.rz.uni-konstanz.de>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-back From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson) Subject: Re: auto_ptr: : reset and auto_ptr: :operator= Message-ID: <9529510.24138@mulga.cs.mu.OZ.AU> Originator: fjh@munta.cs.mu.OZ.AU Sender: news@cs.mu.OZ.AU (CS-Usenet) Organization: Computer Science, University of Melbourne, Australia References: <44oenv$c6i@gabi.gabi-soft.fr> <44so2o$2h0@eurybia.rz.uni-konstanz.de> Date: Sun, 22 Oct 1995 02:02:46 GMT Approved: fjh@cs.mu.oz.au X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMImmieEDnX0m9pzZAQEraAF7BKPMmLzx9an0pUJPPPmbzcIzA44vovTM oEA6sEepyNMLMU10ocaup38yt70zN+aE =pMeW