NFD源码阅读——noncopyable函数

来源:互联网 发布:office使用技巧软件 编辑:程序博客网 时间:2024/05/19 14:54

        在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.



0 0