从http://wtl.sourceforge.net/下载 WTL 9.0,或者点此链接下载:WTL90_4140_Final.zip,然后解压到你的VC目录下面,我的地址是:C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\WTL,你可...
1 T4语法T4的语法与ASP.NET的方式比较类似。主要包括指令、文本块、控制块。1.1 指令指令主要包括template, output, assembly, import, include等类型,用以告诉T4引擎如何编译和运行一个模板。这些指令相当于T4引擎的配置参数。示例:告诉T4引擎控.....
分类:
其他好文 时间:
2014-07-16 18:11:44
阅读次数:
469
以下内容出自:> 周三,9:00,我刚刚坐到位置,打开电脑准备开始干活。 “小三,小三,叫一下其它同事,到会议室,开会”老大跑过来吼,带着淫笑。还不等大家坐稳,老大就开讲了, “告诉大家一个好消息,昨天终于把牛叉模型公司的口子打开了,要我们做悍马模型,虽然是第一个车辆模型,但是我们有能力,有信...
分类:
其他好文 时间:
2014-07-16 15:44:54
阅读次数:
331
顺序表的实现与分析引 --线性表的抽象基类:template
class LinearList
{
public:
LinearList();
~LinearList();
virtual int Size() const = 0; //返回线性表所能够存储的最大长度
virtual int Length() const = 0; //当前线性表的长度
...
分类:
编程语言 时间:
2014-07-16 14:37:36
阅读次数:
247
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ahhsxy/archive/2009/09/11/4542682.aspx设置注释模板的入口: Window->Preference->Java->Code Style->Code Template 然后展开Comme...
分类:
编程语言 时间:
2014-07-16 14:35:17
阅读次数:
351
经验:Template metaprogramming (TMP, 模板元编程)可将工作由运行期移往编译期,因而得以实现早期错误侦测和更高的执行效率
示例1:
template
void advance(IterT &iter, DistT d){
if(typeid(typename std::iterator_traits::iterator_catogory) == typeid(std::random_access_it...
分类:
编程语言 时间:
2014-07-16 13:20:54
阅读次数:
313
作用域指针
当我们并不打算复制智能指针,只是想保证被分配的资源将被正确地回收,可以采用一种简单得多的解决方案:作用域指针。如下示例代码:
template
class ScopedPtr
{
public:
explicit ScopedPtr(T* p = NULL)
:ptr_(p)
{
}
ScopedPtr& operator=(T* p)
{
if(ptr_ !...
分类:
其他好文 时间:
2014-07-16 11:45:30
阅读次数:
311
1.virtual 函数版本
class GameCharacter{
public:
virtual int healthValue() const; //返回人物的健康指数, derived classes 可重新定义它
};
2.使用 non-virtual interface 手法,那是 Template Method 设计模式的一种特殊形式。
让客户通过 public non-virtual 成员函数间接调用 private virtual 函数
class GameCharacter{
pu...
分类:
编程语言 时间:
2014-07-15 22:36:18
阅读次数:
364
经验:请使用 member function templates(成员函数模板)生成"可接受所有兼容类型"的函数
示例:泛化 copy 构造函数
temmplate
class SmartPtr{
public:
template
SmartPtr(const SmartPtr &other) //member template, 为了生成 copy 构造函数
: heldPtr(other.get()){...}
T *get() const...
分类:
编程语言 时间:
2014-07-15 13:10:24
阅读次数:
319
经验:Templates 生成多个 classes 和多个函数,所以任何 template 代码都不该与某个造成膨胀的 template 参数产生相依关系
因非类型模板参数(non-type template parameters) 而造成的代码膨胀,往往可消除,做法是以函数参数或 class 成员变量替换 template 参数
示例:
template //size_t 是非类型模板参数
class SquareMatrix{
public:
//...
分类:
编程语言 时间:
2014-07-15 13:04:39
阅读次数:
307