淡水求咸

博客园已经停止更新,请移步 http://lovecjh.com/

导航

2012年4月16日

命名避免名字冲突

摘要: 今天在写了模板函数时出现下面情况:程序如下:#include <iostream>#include <string>using namespace std;template <class T> void swap(T &a,T &b)//swap already exist in STL{ T temp(a); a=b; b=temp;}int main(){ string a("hello"),b("world"); //int a=1,b=2; swap(a,b); cout<<&quo 阅读全文

posted @ 2012-04-16 20:02 深圳彦祖 阅读(288) 评论(0) 推荐(0) 编辑