hasMethod

Checks for presence of a method with specified name and type for a given aggregate type.

Members

Static variables

hasMethod
auto hasMethod;
Undocumented in source.
hasMethod
auto hasMethod;
Undocumented in source.

Parameters

T

aggregate type to check

name

method/field name to look for

F

method type (using function keyword for static method, delegate for non-static ones)

Return Value

true if aggregate T has a method/field with an identifier name and type F.

Examples

struct S
{
    int foo1 ( double ) { return 0; }
    static int foo2  ( double ) { return 0; }
    int delegate(double) foo3;
}

static assert ( hasMethod!(S, "foo1", int delegate(double)));
static assert (!hasMethod!(S, "foo1", void delegate(double)));
static assert (!hasMethod!(S, "foobar", int delegate(double)));

static assert ( hasMethod!(S, "foo2", int function(double)));
static assert (!hasMethod!(S, "foo3", int delegate(double)));

Meta