2013年4月17日
摘要: 这段代码是这样的:template<typename T>int compare(const T& t1,const T& t2){ cout<<"范型"<<endl; return 1;}int main(){ cout<<compare("hello","world")<<endl;}template<>int compare<const char*>(const char* const &t1,const char* co 阅读全文
posted @ 2013-04-17 17:27 紫金树下 阅读(122) 评论(0) 推荐(0) 编辑
摘要: That's all there is to it, but before you think that you've got allthis nailed down, answer this: What should be the type T in thefollowing declaration?constant_type<T>::type hello(constant("Hello"));Is it a char*? A const char*? No, it's actually a constant referenceto a 阅读全文
posted @ 2013-04-17 16:53 紫金树下 阅读(127) 评论(0) 推荐(0) 编辑