C++ Logo


Advanced search

Re: [std-proposals] Chimeric Pointer

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Fri, 25 Nov 2022 09:47:05 -0500
There seems to be a broad lack of understanding of what this feature
is doing, probably due to unfamiliarity with the way the wxWidgets
library uses base classes.

wxWidgets uses multiple inheritance in a lot of cases. The two classes
in question, `wxControl` and `wxTextEntry` are both base classes. A
control that wants to have text entry functionality would inherit from
both, but it is also possible to have text entry objects that are not
controls and controls that don't have text entry functionality.

The goal of the proposal is to be able to write a function that takes
a single pointer to any type which inherits from *two or more* base
classes. And then use that pointer to access any function which is
available from any of these base classes.

Concepts can allow one to detect if a given pointer inherits from all
of a set of base classes, but the signature would then have to be a
template which deduces the derived-class type which has these

Personally, I don't think this feature is worth doing. The
concept/template solution is adequate for those who need it, and it's
probably not something that is *broadly* useful. It's a niche feature.

Received on 2022-11-25 14:49:10