Why is this?
rikki cattermole via Digitalmars-d
digitalmars-d at puremagic.com
Mon Sep 5 23:42:48 PDT 2016
On 06/09/2016 6:23 PM, Manu via Digitalmars-d wrote:
> On 6 September 2016 at 16:10, rikki cattermole via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
>> On 06/09/2016 6:07 PM, Manu via Digitalmars-d wrote:
>>>
>>> I have weird thing:
>>>
>>> template E(F){
>>> enum E {
>>> K = F(1)
>>> }
>>> }
>>>
>>> struct S(F = float, alias e_ = E!double.K) {}
>>
>> typeof(E!double.K)
>
> == double ?? Not sure what you're saying.
Basically your code only it is using typeof to get the type after all K
is a value and alias is for types.
template E(F){
enum E {
K = F(1)
}
}
struct S(F = float, alias e_ = typeof(E!double.K)) {
pragma(msg, e_); // E
pragma(msg, E!double.K); // 1.0
pragma(msg, typeof({return E!double.K;}())); // E
}
S!float x;
But yes little weird.
More information about the Digitalmars-d
mailing list