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' ...
随机推荐
- SQLServer中临时表与表变量的区别分析【转】
在实际使用的时候,我们如何灵活的在存储过程中运用它们,虽然它们实现的功能基本上是一样的,可如何在一个存储过程中有时候去使用临时表而不使用表变量,有时候去使用表变量而不使用临时表呢? 临时表 临时表与永 ...
- web api 文档声明
namespaceHelloWebAPI.Controllers{ usingHelloWebAPI.Models; usingSystem; usingSystem.Coll ...
- JQuery中html()方法的注意事项
.html方法当不传参数时用来获取元素的html内容, return this[0] && this[0].nodeType === 1 ? this[0].innerHTML.rep ...
- Nodejs随笔(二):像可执行shell脚本一样,运行node 脚本!
在每次编写nodejs脚本的时候,只需在程序的开头加上如下代码(写过shell脚本的人应该很熟悉): #!/usr/local/bin/node 同时,修改文件权限为可执行: mesogene@mes ...
- 解决ul显示不在div中的问题
css样式 #banner { padding: 0px; } #banner ul { list-style: none; margin: 0px; padding: 0px; text-align ...
- 使用XmlReader读取xml文件之二
在.net开发中经常需要读写xml形式的文件(app.config和web.config分别是WinForm和WebForm中使用到的 xml文件的一个特列,并且微软提供了通用的方法,在此就不赘述了) ...
- Visual Studio快速封装字段方法
在面向对象的编程中我们常常要将各个字段封装为属性,但是当字段多的时候往往这个重复的操作会大大降低我们的开发效率,那么如何才能快速的封装字段呢?下面就给大家2个解决方法: 1.使用封装字段方法: 选中字 ...
- linux 日志查看总结
1 grep "ERROR" catalina.log -a 20 -b 10 查看 catalina.log 中error的唯一 一行的后20行 前10行这种情况一般要唯一确定. ...
- UNIX环境高级编程--#include "apue.h"
apue.h头文件为作者自己编写而非系统自带,故需要自行添加! 第一:打开网站 http://www.apuebook.com/第二:选择合适的版本(一共有三个版本,根据书的版本选择)下载源码sour ...
- (转)解决JSP路径问题的方法(jsp文件开头path, basePath作用)
在JSP中的如果使用 "相对路径" 则有可能会出现问题. 因为 网页中的 "相对路径" , 他是相对于 "URL请求的地址" 去寻找资源. ...