🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: auto_ptr again

#3047
From: J. Kanze
Date: Fri, 19 Jan 1996 17:33
46 lines
3262 bytes
In article <AUSTERN.96Jan18103535@isolde.mti.sgi.com> austern (Matt
Austern) writes:

> In article <4djrn4$js1@engnews1.Eng.Sun.COM> clamage@Eng.Sun.COM (Steve Clamage) writes:

> > That point has been beaten to death in the C++ committee and also in
> > this forum. Some people felt an auto_ptr should be able to have multiple
> > owners, but people with experience with this kind of design persuaded
> > the committee that auto_ptrs are too hard to use unless they can have
> > only a single owner. Thus, ownership is transferred upon copying.

> > That is, single ownership is a deliberate design decision based on the
> > semantics an auto-ptr should have. It is not an implementation issue.

> I thought it was generally agreed that auto_ptrs as currently defined
> were broken---specifically, that the semantics of strict ownership,
> constness, and the binding of temporary objects, ended up making an
> auto_ptr nearly useless for returning a value from a function.  That's
> unfortunate, since returning something from a function is one of the
> situations when it's most important to have some safe wrapper class 
> like auto_ptr.

The only thing I think where there was anything like universal agreement
was that auto_ptr's are nearly useless unless you can copy a temporary
auto_ptr object.  In the exact form that they are described in the
standard, you cannot.  But there were a number of proposed solutions,
most of which maintain the concept of strict ownership.

> I've spent a bit of time trying to come up with bright ideas for
> fixing auto_ptr, but I don't really have any.  Reference-counted
> pointers don't have this particular problem, though, and that might be
> the best argument for putting rc_ptr in the standard in addition to
> (or instead of) auto_ptr.

I use reference counted pointers a lot, but they have their own set of
problems.  I can very well understand the committees reluctance to adapt
them.
-- 
James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils, itudes et rialisations en logiciel orienti objet --
              -- A la recherche d'une activiti dans une region francophone
---
[ 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: <KANZE.96Jan19124039@gabi.gabi-soft.fr>
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
References: <ADxYD_mKQD@qsar.chem.msu.su> <4djrn4$js1@engnews1.Eng.Sun.COM> <AUSTERN.96Jan18103535@isolde.mti.sgi.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
From: kanze@gabi.gabi-soft.fr (J. Kanze)
Newsgroups: comp.std.c++
Subject: Re: auto_ptr again
Date: 19 Jan 1996 09:33:25 PST
Organization: GABI Software, Sarl.
Approved: austern@isolde.mti.sgi.com
Message-ID: <KANZE.96Jan19124039@gabi.gabi-soft.fr>
References: <ADxYD_mKQD@qsar.chem.msu.su> <4djrn4$js1@engnews1.Eng.Sun.COM>
 <AUSTERN.96Jan18103535@isolde.mti.sgi.com>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 19 Jan 1996 11:40:39 GMT
In-Reply-To: austern's message of 18 Jan 1996 11:00:55 PST
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMP/V+ky4NqrwXLNJAQEIIwH9F1Ny/L/0ByguVhwWfwG8JWuUFBqzaXWH
 dJbgxkYnEEo9KhrWecPJmWB8I3nqSri/eDu4ZqIsFTKW1Zn8dz6SzA==
 =Snmz
Originator: austern@isolde.mti.sgi.com