template<typename Derived> | |
struct Clonable | |
{ | |
virtual ~Clonable() = default; | |
std::unique_ptr<Derived> clone() | |
{ | |
return std::unique_ptr<Derived>(cloneImpl()); | |
} | |
protected: | |
virtual Derived* cloneImpl() const = 0; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment