摘要:
条款41: 了解隐式接口和编译期多态对template参数而言,接口是隐式的implicit,奠基于有效表达式。多态则是通过template具现化和函数重载解析(function overloading resolution)发生于编译器。template<typename T>void doProcessing(T& w) {if (w.size() > 10 && w != someNastyWidget) {T temp(w);temp.normalize();temp.swap(w);}}//w要支持的接口由template中执行于w身上的操作 阅读全文
posted @ 2011-07-08 21:28 李大嘴 阅读(509) 评论(0) 推荐(0) 编辑