July 20, 2007 Re: Possible syntax for multiple opCast functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | "BCS" <ao@pathlink.com> wrote in message news:ce0a3343c0718c998f7f0cf2d1e@news.digitalmars.com... >> http://tinyurl.com/2uadhz > > bad link Does this one work for you? http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=20712 Stewart. |
July 20, 2007 Re: Possible syntax for multiple opCast functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | Reply to Stewart,
> "BCS" <ao@pathlink.com> wrote in message
> news:ce0a3343c0718c998f7f0cf2d1e@news.digitalmars.com...
>
>>> http://tinyurl.com/2uadhz
>>>
>> bad link
>>
> Works for me at the moment.
>
> Stewart.
>
OK, works now (must be a non D system :)
|
July 20, 2007 Re: Possible syntax for multiple opCast functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ender KaShae | Reply to Ender,
> B Shropshire Wrote:
>
>> How about treat the opCast function as if it were a template:
>>
>> Class A
>> {
>> int opCast!(int)() { ... } // the opCast operator for casting to int
>> char opCast!(char)() { ... } // the opCast operator for casting to char
>> B opCast!(B)() { ... } // the opCast operator for casting to B
>> }
> rather than have multiple cast use functions like toInt, toChar, toB,
> for derived types use symbols ex: use toInt_ptr for int* or toInt_ar
> for int[] or toInt_ar2 for int[2]
>
> what is needed is implicit conversions
>
?? I don't follow.
|
Copyright © 1999-2021 by the D Language Foundation