Template specialization based on inherit class
This article describes a neat trick: http://www.gotw.ca/publications/mxc++-item-4.htm Here’s the basic idea. You first need an IsDerivedFrom class (this provides runtime and compile-time checking): template<typename D, typename B> class IsDerivedFrom { class No { }; class Yes { No no[3]; }; static Yes Test( B* ); // not defined static No Test( … ); // not … Read more