Skip to content

Instantly share code, notes, and snippets.

@petomalina
Created July 17, 2014 14:01
Show Gist options
  • Save petomalina/ca4062e11b1f07b2768b to your computer and use it in GitHub Desktop.
Save petomalina/ca4062e11b1f07b2768b to your computer and use it in GitHub Desktop.
Type<T> class that works as Type storage
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