vxx2 / vlib / v / checker / tests / cmp_between_struct.vv
31 lines · 22 sloc · 374 bytes · 0c8ce3bcb9fd4a2e5bd5f991a5a07da976d780d7
Raw
1module main
2
3import datatypes
4
5struct Item {
6 priority int
7}
8
9// Issue https://github.com/vlang/v/issues/13318
10
11/*
12fn (a Item) < (b Item) bool {
13 return a.priority < b.priority
14}
15
16fn (a Item) == (b Item) bool {
17 return a.priority == b.priority
18}
19*/
20
21fn main() {
22 min_heap()
23}
24
25fn min_heap() {
26 mut heap := datatypes.MinHeap[Item]{}
27
28 heap.insert(Item{10})
29
30 println(heap)
31}
32