Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Chain(comptime T: type, comptime U: type) = struct {
- t T,
- u U,
- onU bool,
- fn init(t: T, u: U) @This() {
- return @This() {
- .t = t,
- .u = u,
- .onU = false,
- };
- }
- fn next(self: *@This()) @typeOf(T.next).ReturnType {
- return if (self.onU) self.u.next() else self.t.next();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement