struct cannot deduce function from argument types
chmike via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 3 07:44:21 PDT 2016
Oops! Stupid of me. There were three bugs in the code.
Correct code is as follow:
import std.stdio;
class Data
{
string m = "Hello world !";
}
struct IdxElem(D)
{
bool inUse;
D data;
}
IdxElem!(Data)[string] idx;
void main()
{
idx["test1"] = IdxElem!Data(true, new Data);
idx["test2"] = IdxElem!Data(false, new Data);
writeln(idx["test2"].data.m);
writeln("Hello world!");
}
More information about the Digitalmars-d-learn
mailing list