The inheritance approach to type erasure allows users to work simultaneously with multiple implementations.
However, if we only require one implementation at a time, we can choose a simpler and faster approach using the PIMPL pattern.
Click to open in Compiler Explorer.
Leave a comment
What is the purpose of passing std::move(iface) to function taking by value?
void user(SomeInterface data) {