Getting the typeid of an object disguised under an interface

Tomer Filiba via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 28 10:40:15 PDT 2016


On Monday, 28 March 2016 at 14:31:57 UTC, Adam D. Ruppe wrote:
> eeek, plain `cast(Object) obj` works for this! You don't need 
> all that other stuff.

cool! didn't know that. it makes sense now that i think of it.

> You could always call the backtrace function from the debug 
> info if you are on Linux.

yes, but it's used for logging exceptions. instead of doing the 
to-string conversion in place, we just keep the raw pointers and 
do addr2line on demand. so we're given an exception and need to 
extract the bt from it

-tomer



More information about the Digitalmars-d mailing list