The solution, while templated, syntactically very similar to what the OP proposed. 

On Fri, Nov 25, 2022, 20:09 Thiago Macieira via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On Friday, 25 November 2022 09:27:24 PST Gergely Nagy via Std-Proposals wrote:
> Hey Thiago, have you checked my concept based solution above?

I did. That's a separate solution but is still a template. TBH, I like yours
more, but Frederick's request has merit too. I don't think it's enough to
warrant a Standard Library feature, and thus definitely not for a Core Language
one, but it can be solved within a regular library, such as wx itself. I just
wanted to point out it is possible and, quite frankly, probably would be
exactly as costly as the Standard feature would end up being.

In particular, I don't buy the arguments against the template. You can avoid
the problems with static members by moving them to non-template functions that
get used in the template, offloading portions of the work based on the
characteristics of the templated argument. That's where your concepts solution
works.

The other part is that accessing two base sub-objects that don't form a class
itself indicates a design issue. If this use of a text entry and a control is
common, the hierarchy should have been as suggested by Arthur:

    struct TextCtrl : Control, TextEntry {};
    struct TextCtrl1 : TextCtrl {};  // CHANGED!!
    struct TextCtrl2 : TextCtrl {};  // CHANGED!!

And if it is not common, then I don't think we need a Standard feature for.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering



--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals