Topic: Covariance and auto_ptr


Author: oliva@negro.dcc.unicamp.br (Alexandre Oliva)
Date: 1995/11/28
Raw View
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. ]