We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f565e85 commit 8ee5d18Copy full SHA for 8ee5d18
lib/std/pointers.nim
@@ -2,8 +2,10 @@
2
Convenience procs to deal with pointer-like variables.
3
]##
4
5
-proc toUncheckedArray*[T](a: ptr[T]): ptr UncheckedArray[T] {.inline.} =
6
- ## calls `cast[ptr UncheckedArray[T]]` (less error prone).
+proc toUncheckedArray*[T](a: ptr T): ptr UncheckedArray[T] {.inline.} =
+ ## Shortcut for `cast[ptr UncheckedArray[T]](a)`, where T is inferred.
7
+ ## This allows array indexing operations on `a`.
8
+ ## This is unsafe as it returns `UncheckedArray`.
9
runnableExamples:
10
var a = @[10, 11, 12]
11
let pa = a[1].addr.toUncheckedArray
0 commit comments