Advertisement
tinyevil

Untitled

Jun 21st, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. struct vector[T]{
  2. private{
  3. // do not touch my privates
  4. field data:[]ptr T;
  5. field size:uword;
  6. field capacity:uword;
  7. }
  8.  
  9. function new():vector[T]{
  10. return vector[T]{
  11. data = null,
  12. size = 0,
  13. capacity = 0
  14. };
  15. }
  16. }
  17.  
  18.  
  19. vector[i32].new() // fine
  20. vector[i32]{data = null, size = 1, capacity = 1} // fail - visibility mismatch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement