jeudi 30 mars 2017

Force CRTP inheritance

Is it possible to detect that a CRTP base class is templated with the exact same class deriving from base?

I've something like

class GeneratedA : public RegisteredEvent<GeneratedA>;
class GeneratedB : public RegisteredEvent<GeneratedB>;

which works but is it possible to trigger a compile error if the interface is used like this:

class GeneratedB : public RegisteredEvent<GeneratedA>;

Thank you

Aucun commentaire:

Enregistrer un commentaire