Add bit_set type

This commit is contained in:
gingerBill
2018-08-14 17:07:56 +01:00
parent 89f4e7a8db
commit acc010cba5
14 changed files with 509 additions and 45 deletions
+20
View File
@@ -712,6 +712,25 @@ deprecated_attribute :: proc() {
// foo_v1(1);
}
bit_set_type :: proc() {
using Day :: enum {
Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
}
Days :: distinct bit_set[Day];
d: Days;
d = Days{Sunday};
x := Tuesday;
d |= Days{Saturday, x};
fmt.println(d);
}
main :: proc() {
when true {
general_stuff();
@@ -725,5 +744,6 @@ main :: proc() {
complete_switch();
cstring_example();
deprecated_attribute();
bit_set_type();
}
}