Skip to content

Instantly share code, notes, and snippets.

@hdon
Forked from anonymous/gist:37756aa87c27b1a5f738
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hdon/37c10166344548a90088 to your computer and use it in GitHub Desktop.
Save hdon/37c10166344548a90088 to your computer and use it in GitHub Desktop.
T Clone(T)(T object) {
auto size = object.classinfo.init.length;
T ret = cast(T)((cast(void*)object)[0..size].dup.ptr);
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment