I mean, a cloning operator, which by default use the copy constructor and new operator to return a new object. So that if the declaration in the base class is virtual, it would automatically provide a polymorphic cloning mechanism (any class should not be virtual by default)
Advantages:
Avoid doing
Derived * clone() const { return new Derived(*this); }
everywhereAllow standard smart pointers such as
std::unique_ptr
or a dedicated copyable one to clone the object without having them rely on a non standard semantic
Whay would be the risk/drawback?