挺简单的一个类,只是维护了一个成员 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的更多相关文章

  1. boost signal2 slot_base

    先看成员_tracked_objects,从字面上讲是被跟踪的对象,再看,相关函数 bool expired() const,这个函数是检查_tracked_objects是否已经expired.只不 ...

  2. C++ Boost signal2信号/插槽

    #include "stdafx.h" #include "boost/signals2.hpp" #include "boost/bind.hpp& ...

  3. Windows下如何使用BOOST C++库 .

    Windows下如何使用BOOST C++库 我采用的是VC8.0和boost_1_35_0.自己重新编译boost当然可以,但是我使用了 http://www.boostpro.com/produc ...

  4. boost第 4 章 事件处理

    http://zh.highscore.de/cpp/boost/ 1.信号 Signals 2.一旦对象 被销毁,连接就会自动释放. 让 FF类继承自 boost::signals::trackab ...

  5. 比特币源码分析--C++11和boost库的应用

    比特币源码分析--C++11和boost库的应用     我们先停下探索比特币源码的步伐,来分析一下C++11和boost库在比特币源码中的应用.比特币是一个纯C++编写的项目,用到了C++11和bo ...

  6. boost::bind 学习

    最近学习了太多与MacOS与Iphone相关的东西,因为不会有太多人有兴趣,学习的平台又是MacOS,不太喜欢MacOS下的输入法,所以写下来的东西少了很多.    等我学习的东西慢慢的与平台无关的时 ...

  7. c++ 库 boost安装

    http://blog.chinaunix.net/uid-12226757-id-3427282.html ubuntu apt-get install libboost-dev 全部: apt-g ...

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

  9. 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' ...

随机推荐

  1. [Django实战] 第3篇 - 用户认证(初始配置)

    当大家打开一个网站时,第一步做什么?大部分一定是先登录吧,所以我们就从用户认证开始. 打开用户认证 Django本身已经提供了用户认证模块,使用它可以大大简化用户认证模块的开发,默认情况下,用户认证模 ...

  2. Nodejs随笔(三):全局对象之global

    首先,进入node REPL: mesogene@mesogene-team:~$ node > 查看global对象,发现其他全局对象(包括Buffer.require对象)以及全局方法都包含 ...

  3. 推荐两个Laravel插件网站

    1.https://packagist.org 2.http://packalyst.com

  4. PNPOLY - Point Inclusion in Polygon W. Randolph Franklin

    测试目标点是否在多边形内int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy) { int i, j, ...

  5. python----脚本文件的头部写法。

    #!/usr/bin/python #这里主要是为了指明python脚本解释器的路径. #!coding:utf-8#这个是为了告知python脚本文件解释器,此脚本的字符集. import sys ...

  6. 使用Task简化Silverlight调用Wcf

    原文http://www.cnblogs.com/lemontea/archive/2012/12/09/2810549.html 从.Net4.0开始,.Net提供了一个Task类来封装一个异步操作 ...

  7. Activitys, Threads, & Memory Leaks

    Activitys, Threads, & Memory Leaks 在Android编程中,一个公认的难题是在Activity的生命周期如何协调长期运行的任务和避免有可能出现的内存泄漏问题. ...

  8. Ubuntu-升级linux软件源,安装vim/五笔

    重装linux后 软件都没了. 这些是要做的: (1):升级软件源 sudo gedit  /etc/apt/source.list 打开后ctrl c 下面的源 ##网易的源(163源,无论是不是教 ...

  9. 剑指Offer:面试题25

    题目描述: 输入一颗二叉树和一个整数,打印出二叉树中结点值的和为输入整数的所有路径.路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径.九度OJ地址:http://ac.jobdu.c ...

  10. aix Mysql-Rpm puppet puppetAgent

    http://www.bullfreeware.com/toolbox.php   (Large Open Source Software Archieve for AIX 提供MySQL5.1 fo ...