Quick actions

cmd+k|ctrl+k

Navigation

Languages

Untitled

Snippet info

Language

Nim

Visibility

unlisted

Author

legacy-anonymous

Created

2016-09-30T06:44:16Z

Updated

2016-09-30T06:44:16Z

type Histogram=object 
  name:string 

template newPtr[T](x:typedesc[T]): ptr[T] = 
  cast[ptr x](alloc0(sizeOf(x))) 

var x = newPtr(Histogram)
x[] = Histogram(name: "Sales")
echo x.name
INFO