Structs can't be zero bytes in size?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Sep 2 17:04:33 PDT 2013
On 9/3/13, Dylan Knutson <tcdknutson at gmail.com> wrote:
> Take a look at this:
>
> http://dpaste.dzfl.pl/6bf578a3
I suggest:
-----
void sendPayload(Resp)(Resp response)
{
static if(Resp.sizeof) {
pragma(msg, "has a size");
}
else {
pragma(msg, "has no size");
}
}
void main()
{
sendPayload(cast(void[0])[]);
}
-----
So try to use `void[0]` as a type. When you have such a type, you can
initialize it with [], for example:
-----
void[0][int] hash;
void main()
{
hash[1] = [];
assert(1 in hash);
}
-----
More information about the Digitalmars-d
mailing list