Created
July 17, 2014 14:01
-
-
Save petomalina/ca4062e11b1f07b2768b to your computer and use it in GitHub Desktop.
Type<T> class that works as Type storage
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
template <typename T> | |
class Type { | |
public: | |
Type() {} | |
virtual ~Type() {} | |
virtual T* allocate() const { return new T; } | |
virtual T* cast(void *object) const { return static_cast<T*>(object); } | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment