Thread overview | ||||||
---|---|---|---|---|---|---|
|
May 02, 2014 In need for CommonOriginalType | ||||
---|---|---|---|---|
| ||||
In order to make https://github.com/nordlow/justd/blob/master/enums.d more type-safe (restrict type arguments to EnumUnion) I need a type trait, say, CommonOriginalType(E...) Do I have to use recursion (like in CommonType) to implement this or is there a better way? See also: http://forum.dlang.org/thread/bjburcdtcejohtpmqmay@forum.dlang.org?page=2#post-lveiwblfoommtjninxki:40forum.dlang.org |
May 02, 2014 Re: In need for CommonOriginalType | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On 02/05/14 19:24, "Nordlöw" via Digitalmars-d-learn wrote: > Do I have to use recursion (like in CommonType) to implement this or is there a > better way? Won't it work to use, is(CommonType!(OriginalType!T1, OriginalType!T2) ... ? |
May 02, 2014 Re: In need for CommonOriginalType | ||||
---|---|---|---|---|
| ||||
On 02/05/14 20:03, Joseph Rushton Wakeling via Digitalmars-d-learn wrote:
> On 02/05/14 19:24, "Nordlöw" via Digitalmars-d-learn wrote:
>> Do I have to use recursion (like in CommonType) to implement this or is there a
>> better way?
>
> Won't it work to use,
>
> is(CommonType!(OriginalType!T1, OriginalType!T2)
... missing a closing bracket there :-P
|
May 02, 2014 Re: In need for CommonOriginalType | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | > is(CommonType!(OriginalType!T1, OriginalType!T2) > > ... ? I need it to be variadic. I cracked it: import std.typetuple: staticMap; import std.traits: CommonType, OriginalType; alias CommonOriginalType(T...) = CommonType!(staticMap!(OriginalType, T)); /per |
Copyright © 1999-2021 by the D Language Foundation