Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
December 09, 2015 [Issue 15427] dynamic casting functions should be available in TypeInfo_Class | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15427 Ketmar Dark <ketmar@ketmar.no-ip.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ketmar@ketmar.no-ip.org -- |
December 09, 2015 [Issue 15427] dynamic casting functions should be available in TypeInfo_Class | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15427 --- Comment #1 from Ketmar Dark <ketmar@ketmar.no-ip.org> --- p.s. `ti.dynamicCast(O)` should still return `void*`. not a big deal, it's very internal API anyway. -- |
December 09, 2015 [Issue 15427] dynamic casting functions should be available in TypeInfo_Class | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15427 --- Comment #2 from Ketmar Dark <ketmar@ketmar.no-ip.org> --- sample patch: diff --git a/src/object.d b/src/object.d index 097fc5a..6eb9163 100644 --- a/src/object.d +++ b/src/object.d @@ -21,6 +21,8 @@ private { extern (C) Object _d_newclass(const TypeInfo_Class ci); extern (C) void rt_finalize(void *data, bool det=true); + extern (C) void* _d_dynamic_cast(Object o, ClassInfo c); + extern (C) int _d_isbaseof(ClassInfo oc, ClassInfo c); } // NOTE: For some reason, this declaration method doesn't work @@ -860,6 +862,17 @@ unittest */ class TypeInfo_Class : TypeInfo { + final void* dynamicCast (Object o) + { + return (o !is null ? _d_dynamic_cast(o, this) : null); + } + + // is this typeinfo base of `o`? + final bool baseOf (Object o) + { + return (o !is null ? (_d_isbaseof(typeid(o), this) != 0) : false); + } + override string toString() const { return info.name; } override bool opEquals(Object o) -- |
December 17, 2022 [Issue 15427] dynamic casting functions should be available in TypeInfo_Class | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15427 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P4 -- |
December 07 [Issue 15427] dynamic casting functions should be available in TypeInfo_Class | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15427 --- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17318 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation