🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Add dynamic_cast<type_info&>

#1902
From: Etay Bogner
Date: Mon, 04 Sep 1995 16:41
26 lines
1583 bytes
Hi All,

While playing with Metrowerks RTTI implementation ( THE C++ Compiler for the Mac 
), I encounter the lack of a dynamic_cast which works on a type_info&.
I won't get into how dynamic_cast works today when operating on types ( T's ). 
For instance : dynamic_cast<D*>(b) where b is a B*, and D is derived from B, or 
dynamic_cast<void*>(b) which returns the complete object.

Since all the information needed CAN be ( and probably IS ) taken from a 
type_info structure ( or the virtual table, in any case, they can both point to 
the same structure ), why not have a dynamic_cast<type_info&) ?

So one can pass a type_info, which was NOT obtained via typeid(), to a function 
which will, among others, use dynamic_cast ...

Etay.

-- Etay Bogner,
-- Etay_Bogner@mail.stil.scitex.com,
-- Scitex Corp.
-- Israel.


[ 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: <9508048102.AA810263857@mail.stil.scitex.com>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: "Etay Bogner" <Etay_Bogner@mail.stil.scitex.com>
Newsgroups: comp.std.c++
Subject: Add dynamic_cast<type_info&>
Date: 4 Sep 1995 16:41:40 GMT
Organization: ?
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <9508048102.AA810263857@mail.stil.scitex.com>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
To: std-c++@ncar.ucar.edu
Return-Receipt-To: Etay_Bogner@mail.stil.scitex.com
Content-Length: 819
X-Lines: 22
Originator: clamage@taumet