Role

Undocumented in source.

Members

Aliases

UnsignedType
alias UnsignedType = ushort
Undocumented in source.

Functions

opCast
UnsignedType opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
toUnsigned
UnsignedType toUnsigned()

Convert to UnsignedType u.

Manifest constants

unsignedMax
enum unsignedMax;
Undocumented in source.
unsignedMin
enum unsignedMin;
Undocumented in source.

Static functions

fromUnsigned
typeof(this) fromUnsigned(UnsignedType u)

Create from UnsignedType u.

Variables

rel
Rel rel;
Undocumented in source.
reversion
bool reversion;
Undocumented in source.

Examples

assignment from range

1 auto set = StaticDenseSetFilter!(Role)();
2 static assert(set.sizeof == 1);
3 
4 assert(set.toString == "StaticDenseSetFilter!(Role, true)([])");
5 
6 // inserts
7 foreach (const rel; [EnumMembers!Rel])
8 {
9     assert(!set.contains(Role(rel)));
10     assert(!set.contains(Role(rel, true)));
11 
12     set.insert(Role(rel));
13     assert(set.contains(Role(rel)));
14 
15     assert(!set.contains(Role(rel, true)));
16     set.insert(Role(rel, true));
17 
18     assert(set.contains(Role(rel)));
19     assert(set.contains(Role(rel, true)));
20 }
21 
22 assert(set.toString == "StaticDenseSetFilter!(Role, true)([const(Role)(unknown, false), const(Role)(unknown, true), const(Role)(subClassOf, false), const(Role)(subClassOf, true), const(Role)(instanceOf, false), const(Role)(instanceOf, true), const(Role)(memberOf, false), const(Role)(memberOf, true)])");
23 
24 // removes
25 foreach (const rel; [EnumMembers!Rel])
26 {
27     assert(set.contains(Role(rel)));
28     assert(set.contains(Role(rel, true)));
29 
30     set.remove(Role(rel));
31     assert(!set.contains(Role(rel)));
32 
33     assert(set.contains(Role(rel, true)));
34     set.remove(Role(rel, true));
35 
36     assert(!set.contains(Role(rel)));
37     assert(!set.contains(Role(rel, true)));
38 }
39 
40 assert(set.toString == "StaticDenseSetFilter!(Role, true)([])");
41 
42 auto fullSet = StaticDenseSetFilter!(Role).asFull;
43 
44 foreach (const rel; [EnumMembers!Rel])
45 {
46     assert(fullSet.contains(Role(rel)));
47     assert(fullSet.contains(Role(rel, true)));
48 }
49 
50 auto emptySet = StaticDenseSetFilter!(Role)();
51 
52 foreach (const rel; [EnumMembers!Rel])
53 {
54     assert(!emptySet.contains(Role(rel)));
55     assert(!emptySet.contains(Role(rel, true)));
56 }

set operations

import nxt.array_help : s;

enum E : ubyte { a, b, c, d, dAlias = d }

auto a = StaticDenseSetFilter!(E)([E.a].s[]);
auto b = StaticDenseSetFilter!(E)([E.b].s[]);
auto c = StaticDenseSetFilter!(E)([E.b].s[]);

auto a_or_b = StaticDenseSetFilter!(E)([E.a, E.b].s[]);
auto a_and_b = StaticDenseSetFilter!(E)();

assert((a | b | c) == a_or_b);
assert((a & b) == a_and_b);
assert((a & a & b) == a_and_b);

a |= b;
assert(a == a_or_b);

Meta