Add slice.enumerated_array
This commit is contained in:
1 parent
6fe1825db9
commit
c056a0d108
1 file changed
+7
@@ -509,3 +509,10 @@ dot_product :: proc(a, b: $S/[]$T) -> (r: T, ok: bool)
|
|||||||
}
|
}
|
||||||
return r, true
|
return r, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Convert a pointer to an enumerated array to a slice of the element type
|
||||||
|
enumerated_array :: proc(ptr: ^$T) -> []intrinsics.type_elem_type(T)
|
||||||
|
where intrinsics.type_is_enumerated_array(T) {
|
||||||
|
return ([^]intrinsics.type_elem_type(T))(ptr)[:len(T)]
|
||||||
|
}
|
||||||
Reference in new issue
Block a user