Casts

timotheecour timothee.cour2 at gmail.com
Tue Feb 6 21:16:07 UTC 2018


On Wednesday, 22 October 2008 at 18:43:15 UTC, Denis Koroskin 
wrote:
> On Wed, 22 Oct 2008 22:39:10 +0400, bearophile 
> <bearophileHUGS at lycos.com> wrote:
>
>> [...]
>
> You can use the following short-cut to avoid double casting:
>
> if (auto foo = cast(Foo)obj) {
>     ...
> } else if (auto bar = cast(Bar)bar) {
>     ...
> } else {
>     ...
> }

doesn't work with extern(C++) classes see 
https://forum.dlang.org/post/nolylatfyjktnvweyxlu@forum.dlang.org


More information about the Digitalmars-d mailing list