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

sort: fix sorting by struct fields

This commit is contained in:
Alexander Medvednikov
2020-08-12 18:43:41 +02:00
parent e5e31f7210
commit f8be2110ec
3 changed files with 69 additions and 15 deletions

View File

@ -183,3 +183,10 @@ fn (flags []Flag) contains(name string) bool {
return false
}
fn (mut flags []Flag) sort2() {
flags.sort_with_compare(fn (a, b &Flag) int {
return compare_strings(&a.name, &b.name)
})
}