Compare struct against null
downs
default_357-line at yahoo.de
Mon Apr 28 00:44:07 PDT 2008
Heinz wrote:
> Hi,
>
> I have a simple struct and i want to check if a variable has been asigned:
>
> struct hello
> {
>
> }
> ...
> hello h;
> ...
> if(!h)
> {
> do stuff;
> }
>
> When compiling i get erros about opCall not implemented and many others. What can i do?
>
> Thanks in advance.
Structs are value types. Read the spec. Then use a pointer :)
hello* h;
if (!h) h = new hello;
--downs
More information about the Digitalmars-d-learn
mailing list