template27.c
来自「this is a gcc file, you can download it 」· C语言 代码 · 共 49 行
C
49 行
// PRMS Id: 6826// Check that unnecessary templates are not instantiated.template <class T> class Test { public: void doThiss(); void doThat(); };template <class T> void Test<T>::doThiss() { T x; x.thiss(); } template <class T> void Test<T>::doThat() { T x; x.that(); } class A { public: void thiss() {}; };class B{ public: void that() {}; };int main() { Test<A> a; a.doThiss(); // a.doThat() is not well formed, but then // it's not used so needn't be instantiated. Test<B> b; b.doThat(); // simillarly b.doThiss(); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?