Skip to content

Instantly share code, notes, and snippets.

Created January 18, 2015 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/37756aa87c27b1a5f738 to your computer and use it in GitHub Desktop.
Save anonymous/37756aa87c27b1a5f738 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