Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. const Chain(comptime T: type, comptime U: type) = struct {
  2. t T,
  3. u U,
  4. onU bool,
  5. fn init(t: T, u: U) @This() {
  6. return @This() {
  7. .t = t,
  8. .u = u,
  9. .onU = false,
  10. };
  11. }
  12. fn next(self: *@This()) @typeOf(T.next).ReturnType {
  13. return if (self.onU) self.u.next() else self.t.next();
  14. }
  15. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement