> C++’s classical OOP system supports “covariant return types,” but it does not support “contravariant parameter types.”
Interestingly enough, std::function correctly supports contravariant parameters; it also correctly handles co/contra variance correctly via smart pointers (as long as the smart pointers support it themselves of course).
Interestingly enough, std::function correctly supports contravariant parameters; it also correctly handles co/contra variance correctly via smart pointers (as long as the smart pointers support it themselves of course).