hasMethod

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

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

Examples

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

hasField!(TestStruct, method => method.name == "name"); // returns true
hasField!(TestStruct, method => is(method.returnType == int)); // returns false

Meta