hasMethod

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

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

Examples

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

hasField!(TestStruct, "name"); // returns true
hasField!(TestStruct, "age"); // returns false

Meta