Created
November 27, 2009 05:49
-
-
Save robey/243843 to your computer and use it in GitHub Desktop.
This file contains 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
// allows you to do this (manifest is of type Manifest[T]): | |
// val obj: T = manifest.create() | |
implicit def manifest2creator[T](m: Manifest[T]): Creator[T] = new Creator(m) | |
class Creator[T](m: Manifest[T]) { | |
def create(): T = m.erasure.newInstance().asInstanceOf[T] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment