I am trying to publicly infer a class from a template that will force it to inherit from the base class and gain access to protected members. But before the template is expanded, it does not have these rights, so it cannot use the Base element as a template parameter:
using Fun = void (*)(); class Base { protected:
The strange bit about this for me was that friendship with him generally worked. I wondered if I could "sneak in the door" by putting public virtual inheritance from the database before the option:
class Derived : public virtual Base, public Variant<&Base::something>
It did not help.
Question: is there any other trick to avoid explicit mention of all derived classes in the database, but still you have access to the selected protected members from it for template parameters?
(Note. Attempting to do this on an earlier gcc, 4.6.3, it seems that even friendship does not help in this case. Therefore, it seems to be a bit new.)
source share