How do I verify this struct has no value

Student getStudent()
{
    ...
    Student s;
    if(condition) s = Student;
    return s;
}

auto stu = getStudent();

//which will work and is best?
if (stu is null) //doesn't wrk.
if (stu is Student.init) //will confirm when i get to my pc

Or how would you do it? Will you make it null first? (I'm not used to statically typed languages internals)

Another issue. I'm creating a function to authenticate user login. I want to determine login failure (Boolean) and error message but D does have multiple return type (could use struct but will make code dirty).

in such case, would you use a callback delegates function or will use a string (str == "ok", str == "no") or go with a struct?


Reply via email to