hasField

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

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

Examples

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

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

Meta