hasMember

Returns true if a member can be found on aggregate with the given memberName, false otherwise.

  1. auto hasMember()
    @safe pure nothrow
    hasMember
    (
    alias aggregate
    string memberName
    )
    ()
    if (
    isAggregate!aggregate ||
    isModule!aggregate
    )
  2. auto hasMember()

Examples

struct S {
    long id;
    int age;
    string name() {
        return "name";
    }
}

hasMember!(S, "id"); // returns true
hasMember!(S, "name"); // returns true
hasMember!(S, "doesNotExist"); // returns false

Meta