2014年3月21日

c++模板两个数的加法

摘要: 1、最简单的情况: templateT Add(const T& a, const T& b){ return a + b;} 缺点是不能够处理不同类型的数据,例如Add(100, 100.0f); 2、第二种情况: templateT1 Add1(T1 lhs, T2 rhs){ return... 阅读全文

posted @ 2014-03-21 20:07 dchao 阅读(2010) 评论(0) 推荐(0) 编辑

导航