摘要:
在实际项目中,需要对一个图像做很多次转换,此时就可能会频繁的增加或修改一部分代码,这个时候用访问者模式是一个较为简单的解决方案例如:#ifndef IMG_H#define IMG_Htemplate<class T>class Image{ typedef T _Color_Type; //... template<class RET,class TransformFun> RET Transform(Transform const & fun){//要多次调用此函数对本图像进行一些转换. return fun(*this); }}#endif而在另一个文件中 阅读全文
posted @ 2011-10-20 21:01
Ruby_March
阅读(225)
评论(0)
推荐(0)
2011年10月20日