🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Extended typeinfo (was- dyn

#1939
From: Jason Merrill
Date: Sat, 09 Sep 1995 19:23
28 lines
1431 bytes
>>>>> mfinney  <mfinney@inmind.com> writes:

> In <n1401567773.54923@taligent.com>, "Bill Gibbons" <bill_gibbons@taligent.com> writes:
>> The proposed extended_type_info is given below.

> This "extended" RTTI is a good start, but it is still missing
> something crucial to many programs.  That is the ability
> to ask if object x is the same class or a subclass of a
> type or another object.

Hmm?  What about

if (Derived *p = dynamic_cast<Derived*>(possible_derived))
  {
     do_something_special (p);
  }

Does this not ask whether possible_derived is a pointer to either a
Derived or a subclass of Derived?  It doesn't look like 'isa', but it's
just as powerful.  See D&E for the rationale behind choosing this syntax.

Jason

---
[ 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: <MATT.95Sep9122342@physics10.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
References: <n1401567773.54923@taligent.com> <42rf97$p8h@mujibur.inmind.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: jason@cygnus.com (Jason Merrill)
Newsgroups: comp.std.c++
Subject: Re: Extended typeinfo (was- dyn
Date: 09 Sep 1995 19:23:42 GMT
Organization: Cygnus Support, Mountain View, CA
Approved: matt@physics10.Berkeley.EDU (Matt Austern)
Message-ID: <MATT.95Sep9122342@physics10.Berkeley.EDU>
References: <n1401567773.54923@taligent.com> <42rf97$p8h@mujibur.inmind.com>
NNTP-Posting-Host: physics10.berkeley.edu