🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Observations on templates

#3317
From: Pulkkinen Esa
Date: Mon, 12 Feb 1996 18:16
20 lines
1851 bytes
In article <4fa6d0$115g@news.gate.net>, Ken Walter <solution@gate.net> wrote:
>template <class T, class S> T cast_d( S s) { return dynamic_cast<T>s; }

>Casts could almost be implemented without being part of the language.
>
They can. But it's too much work for the programmer to do it. I've used
a simulation of a dynamic_cast when I didn't have a compiler that supports
them. The problem with such a simulation is that you have to provide
most of the information dynamic_cast uses by yourself (for the second time), 
even though you have already provided the compiler with the same
information in the class declaration. Or you can use macro hackery
to do that for you, but that's ugly.
-- 
   Esa Pulkkinen                        | C++ programmers do it virtually
   E-Mail:  esap@cs.tut.fi              | everywhere with a class, resulting
   WWW   :  http://www.cs.tut.fi/~esap/ | in multiple inheritance.
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
Technical Details
Message-ID: <4fiv5e$fda@peippo.cs.tut.fi>
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!auster
References: <ACVI83na99@qsar.chem.msu.su> <4fa6d0$115g@news.gate.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!auster
From: esap@cs.tut.fi (Pulkkinen Esa)
Newsgroups: comp.std.c++
Subject: Re: Observations on templates
Date: 12 Feb 1996 10:16:10 PST
Organization: Tampere University of Technology
Approved: austern@isolde.mti.sgi.com
Message-ID: <4fiv5e$fda@peippo.cs.tut.fi>
References: <ACVI83na99@qsar.chem.msu.su> <4fa6d0$115g@news.gate.net>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 10 Feb 1996 20:28:30 GMT
Nntp-Posting-User: esap
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMR+D/0y4NqrwXLNJAQEuqgH9HSED3NeTyvJ51oxSYE6QSl2bIXjoye8Y
 Lmg1VfQDCHfIX+TyvwuaZzWpJzWc55wPU9Aww7Dj5HJY5zVSi8+u2g==
 =NxVr
Originator: austern@isolde.mti.sgi.com