Created
July 29, 2014 23:03
-
-
Save flaviut/27d152172a4c26b804c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unsigned | |
type | |
FArray* {.unchecked.} [T] = array[0..1, T] | |
PArray*[T] = ref FArray[T] | |
proc box*[T](val: T): ref T = | |
new result | |
result[] = val | |
converter array2FArray[I, T](arr: ref array[I, T]): PArray[T] = | |
cast[PArray[T]](arr) | |
let x: PArray[int] = PArray(box([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment