File tree 2 files changed +47
-0
lines changed
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ comptime {
23
23
_ = @import ("behavior/bugs/1486.zig" );
24
24
_ = @import ("behavior/bugs/1500.zig" );
25
25
_ = @import ("behavior/bugs/1607.zig" );
26
+ _ = @import ("behavior/bugs/1735.zig" );
26
27
_ = @import ("behavior/bugs/1851.zig" );
27
28
_ = @import ("behavior/bugs/1914.zig" );
28
29
_ = @import ("behavior/bugs/2006.zig" );
Original file line number Diff line number Diff line change
1
+ const std = @import ("std" );
2
+
3
+ const mystruct = struct {
4
+ pending : ? listofstructs ,
5
+ };
6
+ pub fn TailQueue (comptime T : type ) type {
7
+ return struct {
8
+ const Self = @This ();
9
+
10
+ pub const Node = struct {
11
+ prev : ? * Node ,
12
+ next : ? * Node ,
13
+ data : T ,
14
+ };
15
+
16
+ first : ? * Node ,
17
+ last : ? * Node ,
18
+ len : usize ,
19
+
20
+ pub fn init () Self {
21
+ return Self {
22
+ .first = null ,
23
+ .last = null ,
24
+ .len = 0 ,
25
+ };
26
+ }
27
+ };
28
+ }
29
+ const listofstructs = TailQueue (mystruct );
30
+
31
+ const a = struct {
32
+ const Self = @This ();
33
+
34
+ foo : listofstructs ,
35
+
36
+ pub fn init () Self {
37
+ return Self {
38
+ .foo = listofstructs .init (),
39
+ };
40
+ }
41
+ };
42
+
43
+ test "intialization" {
44
+ var t = a .init ();
45
+ std .testing .expect (t .foo .len == 0 );
46
+ }
You can’t perform that action at this time.
0 commit comments