挺简单的一个类,只是维护了一个成员 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. About Health Monitor Checks

    About Health Monitor Checks Health Monitor checks (also known as checkers, health checks, or checks) ...

  2. mysql binlog解析概要

    1,dump协议: 根据数据库的ip+port创建socket,如果创建成功,说明链接建立成功,接下来是使用dump协议订阅binlog 链接建立成功之后,服务端会主动向客户端发送如下问候信息gree ...

  3. (转)c#对象内存模型

    对象内存模型 C#的对象内存模型写这篇博客的主要目的是为了加深自己的理解,如有不对的地方,请各位见谅. C#的对象内存模型: 一.栈内存和堆内存1.栈内存 由编译器自动分配和释放,主要用来保存一些局部 ...

  4. Node.js服务的重启与监控

    开始:Node +服务文件名 停止:直接快捷键Ctrl+C 监控:1.安装 npm install supervisor -g, 2.supervisor app.js 参考:http://blog. ...

  5. *++p和*p++的区别

    *p++:先是用*p这个值,然后再使p的地址加1. #include<iostream>using namespace std;int main(){    char s[81]=&quo ...

  6. struts2笔记11-OGNL

    1.OGNL Object-Graph Navigation Language,对象-图 导航语言,可以方便的操作struts2值栈对象 2.对象栈操作方法 (1)action普通属性的访问方法 &l ...

  7. Jquery 解决 H5 placeholder元素问题

    <style type="text/css"> .placeholder{ color: #cacaca; } </style> <script ty ...

  8. Android设置全屏

    全屏显示 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLA ...

  9. 安装gstreamer

    安装gstreamerglib2.44.0locate libffi.soexport LIBFFI_CFLAGS=-L/opt/vagrant/embedded/lib/./confiure./co ...

  10. C++ 文件的复制、删除、重命名

    一.文件的复制 #include <iostream>#include <fstream>using namespace std; int CopyFile(char *Sou ...