NFD源码阅读——noncopyable函数

        在NFD家目录(http://named-data.net/doc/NFD/current/)中点击API Documentation (doxygen)。即可看到NFD的源码目录(NFD  http://named-data.net/doc/NFD/current/doxygen/inherits.html)。在首页中第一栏目录中选择Classes,第二栏目录中选择Class Hierarchy就可以看到类之间的继承关系。

        当想要查阅其中的一个类的时候,点击那个类。页面中就会出现这个类的继承关系,友元类。声明和定义的位置。


NFD中用的是boost库中的noncopyable类。noncopyable类的构造函数和析构函数都是protected的,可以看出它只能作为一个基类。





   Dave Abrahams notes concern about the effect on compiler optimization of adding (even trivial inline) destructor declarations. He says:Probably this concern is misplaced, because noncopyable will be used mostly for classes which own resources and thus have non-trivial destruction semantics.

   With C++2011, using an optimized and trivial constructor and similar destructor can be enforced by declaring both and marking them default. This is done in the current implementation.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值