Implicit Constructors
Meta
jared771 at gmail.com
Fri Oct 13 14:22:05 UTC 2017
On Friday, 13 October 2017 at 13:19:24 UTC, Adam D. Ruppe wrote:
> On Friday, 13 October 2017 at 06:33:14 UTC, Jacob Carlborg
> wrote:
>> Not sure what the purpose of the latter is.
>
> I think it is just so you can do (T)(T...) in a template and
> have it work across more types; unified construction syntax.
>
> Though why it doesn't work with structs is beyond me.
It'd be nice if it did, because I believe it would enable the
following:
import std.stdio;
import std.variant;
void test(Variant[] va...)
{
foreach (v; va)
{
writeln(v.type);
}
}
void main()
{
test(1, "asdf", false); //Currently doesn't compile
}
More information about the Digitalmars-d
mailing list