Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active September 8, 2017 11:13
Embed
What would you like to do?
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