containsBitFlags

Validates that field contains only bits from E.

bool
containsBitFlags
(
E
)
()

Parameters

E

Some $(D_KEYWORD enum).

field E

Bit field.

Return Value

Type: bool

$(D_KEYWORD true) if field is valid, $(D_KEYWORD false) otherwise.

Examples

enum E
{
    one,
    two,
    three,
}
assert(containsBitFlags(E.one | E.two));
assert(!containsBitFlags(cast(E) 0x8));

Meta