boost signal2 trackable
挺简单的一个类,只是维护了一个成员 shared_ptr<detail::trackable_pointee> _tracked_ptr; 这样看来的话,所谓的track还是基于智能指针,这里注意,track的对象需要从trackable_pointee继承,一个空类,主要还是为了用于标识。
#ifndef BOOST_SIGNALS2_TRACKABLE_HPP
#define BOOST_SIGNALS2_TRACKABLE_HPP #include <boost/assert.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp> namespace boost {
namespace signals2 {
namespace detail
{
class tracked_objects_visitor; // trackable_pointee is used to identify the tracked shared_ptr
// originating from the signals2::trackable class. These tracked
// shared_ptr are special in that we shouldn't bother to
// increment their use count during signal invocation, since
// they don't actually control the lifetime of the
// signals2::trackable object they are associated with.
class trackable_pointee
{};
}
class trackable {
protected:
trackable(): _tracked_ptr(static_cast<detail::trackable_pointee*>(0)) {}
trackable(const trackable &): _tracked_ptr(static_cast<detail::trackable_pointee*>(0)) {}
trackable& operator=(const trackable &)
{
return *this;
}
~trackable() {}
private:
friend class detail::tracked_objects_visitor;
weak_ptr<detail::trackable_pointee> get_weak_ptr() const
{
return _tracked_ptr;
} shared_ptr<detail::trackable_pointee> _tracked_ptr;
};
} // end namespace signals2
} // end namespace boost #endif // BOOST_SIGNALS2_TRACKABLE_HPP
boost signal2 trackable的更多相关文章
- boost signal2 slot_base
先看成员_tracked_objects,从字面上讲是被跟踪的对象,再看,相关函数 bool expired() const,这个函数是检查_tracked_objects是否已经expired.只不 ...
- C++ Boost signal2信号/插槽
#include "stdafx.h" #include "boost/signals2.hpp" #include "boost/bind.hpp& ...
- Windows下如何使用BOOST C++库 .
Windows下如何使用BOOST C++库 我采用的是VC8.0和boost_1_35_0.自己重新编译boost当然可以,但是我使用了 http://www.boostpro.com/produc ...
- boost第 4 章 事件处理
http://zh.highscore.de/cpp/boost/ 1.信号 Signals 2.一旦对象 被销毁,连接就会自动释放. 让 FF类继承自 boost::signals::trackab ...
- 比特币源码分析--C++11和boost库的应用
比特币源码分析--C++11和boost库的应用 我们先停下探索比特币源码的步伐,来分析一下C++11和boost库在比特币源码中的应用.比特币是一个纯C++编写的项目,用到了C++11和bo ...
- boost::bind 学习
最近学习了太多与MacOS与Iphone相关的东西,因为不会有太多人有兴趣,学习的平台又是MacOS,不太喜欢MacOS下的输入法,所以写下来的东西少了很多. 等我学习的东西慢慢的与平台无关的时 ...
- c++ 库 boost安装
http://blog.chinaunix.net/uid-12226757-id-3427282.html ubuntu apt-get install libboost-dev 全部: apt-g ...
- Using Boost Libraries in Windows Store and Phone Applications
Using Boost Libraries in Windows Store and Phone Applications RATE THIS Steven Gates 18 Jul 2014 5:3 ...
- Visual Studio 2013 boost
E:\Visual Studio 2013\install\VC\bin\amd64>E:\IFC\boost_1_56_0_vs2013'E:\IFC\boost_1_56_0_vs2013' ...
随机推荐
- js添加、删除Cookie
//cookie function addCookie(objName, objValue, objHours) { //添加cookie var str = objName + "=&qu ...
- lua的学习
lua是什么 Lua是一中嵌入式的脚本语言. Lua语言可以独立进行编程,但这不是其主要的使用方式.Lua虽然有动态.灵活的语法提供强大的功能,但并不像 Java.Python 等一样有一个完善的库( ...
- flexigrid 修改json格式
1.修改默认的json格式为key:value 修改前 rows: [{id:'ZW',cell:['ZW','ZIMBABWE','Zimbabwe','ZWE','716']},{id:'ZW', ...
- 【精度问题】【HDU2899】Strange fuction
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- mysql 重启
/etc/init.d/mysql restart /etc/init.d/mysql stop /etc/init.d/mysql start
- hibernate-annotation CascadeType.PERSIST不起作用的解决方法
有如下两个实体类 , Student和Grade 为多对一关系. Student.java @Entity public class Student { private Integer id; pri ...
- android Mvp简单实用
View 对应于Activity,负责View的绘制以及与用户交互Model 依然是业务逻辑和实体模型Presenter 负责完成View于Model间的交互 模拟客户端的登录操作,并实现登录成功与登 ...
- android上传json与服务器交互
http://www.2cto.com/kf/201403/289328.html http://www.tuicool.com/articles/FZJR3eB
- 5款免费Windows远程连接Linux桌面软件(VNC客户端)
不论我们出于何种的用途目的,很多朋友有需要用到VNC链接Linux桌面环境,之前老左有分享过VNC Viewer绿色软件,昨天有朋友提出来使用之后登录远程桌面的界面.分辨率等有些色差.流畅程度 ...
- Spring注释(转)
转自:http://www.ibm.com/developerworks/cn/java/j-lo-spring25-ioc/#ibm-pcon 概述 注释配置相对于 XML 配置具有很多的优势: 它 ...