Casts

Jonathan Marler johnnymarler at gmail.com
Tue Feb 6 21:41:14 UTC 2018


On Tuesday, 6 February 2018 at 21:35:11 UTC, Steven Schveighoffer 
wrote:
> On 2/6/18 4:16 PM, timotheecour wrote:
>> 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
>
> Thimotheecour, I'm not sure how you find these threads. This 
> one is almost 10 years old! Back then, C++ class integration 
> wasn't even a twinkling in Walter's eye ;)
>
> -Steve

Lol, I did the same thing once...I think I may have clicked a 
link on an old thread, and when I went back to the "page view" it 
must have gone back to the "page view" where the original thread 
was listed.   I saw an interesting thread an responded and then 
someone let me know it was 7 years old...I had no idea!!!


More information about the Digitalmars-d mailing list