摘要:
因在模板函数中使用new分配内存,总是不对,后写了这样一段代码测试template typename Tunsigned tt(){ return sizeof(T); }int main(){ unsigned n = sizeof(unsigned char); // n为1 unsigned n1 = ttunsigned char(); // n1为8 unsigned n2 = ttdouble(); // n2也为8 return 0;} 这样表明返回的类型的大小不对,即VC6.0没能识别出类型T来,但是此段代码在g++ 3.4.5中n1是1的 由于template 阅读全文
posted @ 2009-08-20 13:31 红波 阅读(587) 评论(0) 推荐(0)
浙公网安备 33010602011771号