2
0
gingerBill 5 жил өмнө
parent
commit
4930a9c1a4
1 өөрчлөгдсөн 8 нэмэгдсэн , 0 устгасан
  1. 8 0
      core/mem/mem.odin

+ 8 - 0
core/mem/mem.odin

@@ -279,3 +279,11 @@ calc_padding_with_header :: proc(ptr: uintptr, align: uintptr, header_size: int)
 
 	return int(padding);
 }
+
+
+
+clone_slice :: proc(slice: $T/[]$E, allocator := context.allocator, loc := #caller_location) -> T {
+	new_slice := make(T, len(slice), allocator, loc);
+	copy(new_slice, slice);
+	return new_slice;
+}