nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
09a418c
)
lib/standard/bytes: Added pop method
author
Lucas Bajolet
<r4pass@hotmail.com>
Mon, 13 Jul 2015 14:45:18 +0000
(10:45 -0400)
committer
Lucas Bajolet
<r4pass@hotmail.com>
Mon, 13 Jul 2015 14:45:18 +0000
(10:45 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/standard/bytes.nit
patch
|
blob
|
history
diff --git
a/lib/standard/bytes.nit
b/lib/standard/bytes.nit
index
2a3526f
..
21d54d0
100644
(file)
--- a/
lib/standard/bytes.nit
+++ b/
lib/standard/bytes.nit
@@
-96,6
+96,16
@@
class Bytes
end
end
+ # var b = new Bytes.empty
+ # b.append([0x41u8, 0x41u8, 0x18u8])
+ # b.pop
+ # assert b.to_s == "AA"
+ redef fun pop do
+ assert length >= 1
+ length -= 1
+ return items[length]
+ end
+
redef fun clear do length = 0
# Regenerates the buffer, necessary when it was persisted