On 01/18/2016 02:08 PM, Voitech wrote:

> alias Element =Algebraic!(real,string);
>
> i will get:
>
> Cannot store a int in a VariantN!(16LU, real, string)

Are you really storing a 'real' or a 'string'? (The default floating type in D is double, not real.) The following compiles and works as expected with dmd v2.069.2:

import std.variant;

void main() {
    alias Element =Algebraic!(real,string);
    auto r = Element(1.2L);
    auto s = Element("hello");
}

Ali

Reply via email to