hasFunctionAttributes

Determines whether a function has attribute.

This template should get at least two arguments: the function itself and the attributes it should be tested for. If more than one attribute is given, $(D_PSYMBOL hasFunctionAttributes) evaluates to $(D_KEYWORD true) if all of them are present. The attributes should be $(D_PSYMBOL FunctionAttribute) members.

template hasFunctionAttributes (
Args...
) if (
Args.length > 1 &&
&&
isCallable!(Args[0])
&&
allSameType!(Map!(TypeOf, Args[1..$]))
) {}

Members

Manifest constants

hasFunctionAttributes
enum hasFunctionAttributes;
Undocumented in source.

Templates

Reduce
template Reduce(Args_...)
Undocumented in source.

Variables

field
enum uint field;
Undocumented in source.
pred
enum uint pred(Args_...);
Undocumented in source.

Parameters

Args

The function and attributes.

Return Value

Examples

static struct Range
{
    @property auto front() inout
    {
        return 8;
    }
}
static assert(hasFunctionAttributes!(Range.init.front, FunctionAttribute.inout_));
static assert(!hasFunctionAttributes!(Range.init.front, FunctionAttribute.const_));
static assert(!hasFunctionAttributes!(Range.init.front,
              FunctionAttribute.inout_, FunctionAttribute.const_));

See Also

$(D_PSYMBOL FunctionAttribute).

Meta