Gitly
English
Русский
Español
日本語
中文
Português
Pricing
Log in
Register
vxx2
/
vlib
/
v
/
checker
/
tests
/
generic_mut_struct_index_err.vv
17
lines
·
15
sloc
·
216 bytes
·
0c8ce3bcb9fd4a2e5bd5f991a5a07da976d780d7
Raw
1
pub struct Heap[T] {
2
mut:
3
arr []&T
4
}
5
6
fn (mut h Heap[T]) insert(mut element T, pos int) {
7
h[pos] = element
8
}
9
10
fn main() {
11
mut h := &Heap[int]{
12
arr: []&int{cap: 10}
13
}
14
mut a := 3
15
h.insert(mut &a, 0)
16
dump(h)
17
}
18