摘要: 什么是CRTP?Thecuriously recurring template pattern(CRTP) is aC++idiom in which a classXderives from a class template instantiation usingXitself as template argument.类X继承了一个以X作为模板参数的的模板,这就是CRTP,具体介绍请参看维基百科CRTP简介CRTP的意义是父类(接下来我们称之为CRTP父类,相应的子类成为CRTP子类)知道子类的类型,可以做一些虚函数做不到的事,比如维基百科里面提到的类计数,clone函数这两个东西用虚函数 阅读全文
posted @ 2013-04-03 11:51 mightofcode 阅读(3153) 评论(1) 推荐(1) 编辑