我想检查给定模板的类型是否继承self项目中的基类。它应该像下面示例中预期的那样工作:template是否可以使用模板来做到这一点,如果不能,我还能怎么做? 最佳答案 Following一个examplefromStroustrup:templatestructAssertSameOrDerivedFrom{AssertSameOrDerivedFrom(){&constraints;}public:staticvoidconstraints(){Test*pd=0;Base*pb=pd;}};templatestructYourC