Qxt中的d-pointer技术及改进

本文探讨了Qxt库中d-pointer技术的实现及其与Qt的差异,并指出了其存在的不足,如内存分配次数过多。作者通过改进代码,解决了这些问题,使得使用更加简便,类似于Qt的方式。详细改动及如何使用可在提供的链接中找到。

Qxt是一个Qt的扩展库。其中也用到了d-pointer技术,但是与Qt的区别很大,比起Qt有点不足之处。这里我先简单看下它的实现,然后吸取Qt中的优点进行改进。(最新代码在 https://github.com/wang-bin/d-pointer )

之前写过一篇关于d-pointer的文章 http://blog.youkuaiyun.com/ibingow/article/details/7522157  ,这里很多细节就不重复了。

在qxtglobal.h中相关代码

/****************************************************************************
** This file is derived from code bearing the following notice:
** The sole author of this file, Adam Higerd, has explicitly disclaimed all
** copyright interest and protection for the content within. This file has
** been placed in the public domain according to United States copyright
** statute and case law. In jurisdictions where this public domain dedication
** is not legally recognized, anyone who receives a copy of this file is
** permitted to use, modify, duplicate, and redistribute this file, in whole
** or in part, with no restrictions or conditions. In these jurisdictions,
** this file shall be copyright (C) 2006-2008 by Adam Higerd.
****************************************************************************/

#define QXT_DECLARE_PRIVATE(PUB) friend class PUB##Private; QxtPrivateInterface<PUB, PUB##Private> qxt_d;
#define QXT_DECLARE_PUBLIC(PUB) friend cl
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值