1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

add keys fn.

This commit is contained in:
hiroaki.takeo 2019-06-24 18:29:54 +09:00 committed by Alex Medvednikov
parent 95201ffcd1
commit 35b15b9481

View File

@ -108,6 +108,15 @@ pub fn (m mut map) sort() {
m.is_sorted = true
}
fn (m map) keys() []string {
mut keys := []string{}
for i := 0; i < m.entries.len; i++ {
entry := m.entries[i]
keys << entry.key
}
return keys
}
fn (m map) get(key string, out voidptr) bool {
if m.is_sorted {
// println('\n\nget "$key" sorted')