🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2122

Re: auto_ptr::reset ...

#2122
From: Gary L. Craig
Date: Thu, 05 Oct 1995 14:56
26 lines
1459 bytes
A slight aside from the private copy ctor and assignment op debate.
Can someone solidify the semantics of:

  X* auto_ptr<X>reset(X* ptr = 0)

In the DWP, the only postconditions are that get() == ptr.  However,
shouldn't any previous held object be released first?  

Must a new auto_ptr be created for each newly aquired resource?  

I see reset as a deallocate function + optional rebind to new
resource!

Is this correct?  



--
Gary L. Craig                                   phone: (315) 443-5936
Superlative Software Solutions, Inc.            FAX: (315) 443-4745
2-212 Center for Science and Technology         email: craig@cat.syr.edu   
Syracuse University   Syracuse, NY 13244-4100   http://www.cat.syr.edu/~craig

[ 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: <CRAIG.95Oct5095134@puma.cat.syr.EDU>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: craig@cat.syr.EDU (Gary L. Craig)
Newsgroups: comp.std.c++
Subject: Re: auto_ptr::reset ...
Date: 5 Oct 1995 14:56:19 GMT
Organization: Syracuse University
Approved: clamage@eng.sun.com (comp.std.c++)
Distribution: comp
Message-ID: <CRAIG.95Oct5095134@puma.cat.syr.EDU>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: puma.cat.syr.edu
Content-Length: 726
X-Lines: 22
Originator: clamage@taumet