-
can I tell if 2 slices or 2 dynamic arrays are the same? without comparing each element As I understand, slices and dynamic arrays contain, data pointer, length, and capacity (in dynamic array case) an example use case is |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you wanna know if they point to the same memory I think you want to compare the underlying pointers with package exp
import "core:fmt"
import "core:testing"
@(test)
test_raw_data :: proc(t: ^testing.T) {
tmp: [64]u8
x := tmp[:]
y := tmp[:]
z := tmp[32:]
fmt.println(x, y, z)
a := raw_data(x)
b := raw_data(y)
c := raw_data(z)
fmt.println(a, b, c)
}
|
Beta Was this translation helpful? Give feedback.
If you wanna know if they point to the same memory I think you want to compare the underlying pointers with
raw_data
?