From 3968831264917201052
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc772,b03957313f1e9325
X-Google-Attributes: gidfc772,public
X-Google-Thread: f78e5,b03957313f1e9325
X-Google-Attributes: gidf78e5,public
From: Alexandre Oliva <oliva@dcc.unicamp.br>
Subject: Re: my own 'pointer type'
Date: 1997/03/08
Message-ID: <5fspun$g6m@netlab.cs.rpi.edu>#1/1
X-Deja-AN: 224038755
Sender: cppmods@netlab.cs.rpi.edu
References: <5fjlv7$jjl@netlab.cs.rpi.edu>
X-Submission-Address: c++-submit@netlab.cs.rpi.edu
X-Original-Date: 08 Mar 97 21:47:40 GMT
Organization: IC - UNICAMP - Campinas, SP, Brazil
X-Auth: PGPMoose V1.1 PGP comp.std.c++
Newsgroups: comp.lang.c++.moderated,comp.std.c++


Hyman Rosen writes:

> "Enno Rehling" <enno@uni-paderborn.de> writes:
>> At one point, I had a class B derived from A, and it dawned on me that
>> ptr<B> does not conform to ptr<A>, because it's not derived from it.

> There's a better way than the one you used, but it requires
> support for member templates:

I don't think conversion operators would do it as well as inheritance.

In fact, there are two cases I can think of where such a construction
would not do it well: when an additional user-defined conversion would
be necessary and in cases that presented covariance.

In fact, I'd love if auto_ptr were declared this way, so that
covariance would work with auto_ptr's too:

template <class T, class Base = void>
class auto_ptr : auto_ptr<Base> {
// implementation that just prevents pointers to different types
// from being assigned
};

template <class T>
class auto_ptr<T, void> {
// actual implementation
};

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
Universidade Estadual de Campinas, SP, Brasil

      [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
      [ about comp.lang.c++.moderated. First time posters: do this! ]
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with 
    ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    
    ]
[ FAQ:     
http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:  
http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                        
    ]

      [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
      [ about comp.lang.c++.moderated. First time posters: do this! ]




