Skip to content

Instantly share code, notes, and snippets.

@Varriount
Created February 5, 2020 08:55
Show Gist options
  • Save Varriount/8f4a9046e6fade3fff343bf8540d5aa2 to your computer and use it in GitHub Desktop.
Save Varriount/8f4a9046e6fade3fff343bf8540d5aa2 to your computer and use it in GitHub Desktop.
proc copy[T](d: T): T =
when T is ref:
# return a new reference that is a copy (though not a deep copy) of T
else:
return d # regular object copy logic
proc processData[T](data: T): T =
result = copy(data)
sort(result)
trim(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment