hasFlag

checks flag in bit value

bool
hasFlag
(
T
)
(
,
in T flag
)
if (
isIntegral!T
)

Examples

1 auto a = 0b01;
2 auto b = 0b10;
3 auto c = 0b11;
4 assert( hasFlag(c,a) );
5 assert( hasFlag(c,b) );
6 assert( hasFlag(c,0) );

Meta