🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Covariance and auto_ptr

#2755
From: Alexandre Oliva
Date: Tue, 28 Nov 1995 17:30
26 lines
1072 bytes
Is there anything that can be done to allow auto_ptr covariant return
types, that is:

class foo {
 class bar {};
 auto_ptr<bar> getbar() { return new bar(); }
};

class food /* :-) */ : public foo {
 class bard : public foo::bar {};
 auto_ptr<bard> getbar() { return new bard(); }
};

Thanks in advance
-- 
Alexandre Oliva
oliva@dcc.unicamp.br
Departamento de Ci^encia de Computa,c~ao
Universidade Estadual de Campinas
Campinas  S~ao Paulo  Brazil

---
[ 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: <OLIVA.95Nov28011249@negro.dcc.unicamp.br>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: oliva@negro.dcc.unicamp.br (Alexandre Oliva)
Newsgroups: comp.std.c++
Subject: Covariance and auto_ptr
Date: 28 Nov 1995 17:30:25 GMT
Organization: DCC - UNICAMP - Campinas, SP, Brazil
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <OLIVA.95Nov28011249@negro.dcc.unicamp.br>
NNTP-Posting-Host: physics2.berkeley.edu