boost中serialization模組的單體類

2021-06-22 09:34:26 字數 464 閱讀 9959

// singleton.cpp : 定義控制台應用程式的入口點。

//boost實現單體的兩種方式

//1.通過boost的pool的singleton實現

//2.通過boost的serialization的singleton實現,採用繼承或則定義乙個單體型別

//而且serilization模組的單體類具備鎖功能。

#include "stdafx.h"

#include

#include

#define sgobj(e, type)\

void set##e(const type& t) ;\

type get##e() const ;

class pointmanager : public boost::serialization::singleton

;int _tmain(int argc, _tchar* argv)

BOOST學習 BOOST安裝

2 安裝 等待批處理完成,生成若干新檔案,如果你本地裝有多個版本的vc,預設安裝會使用最高版本的vc,如果想修改用某個版本的vc編譯,用文字工具開啟.boost 1 55 0 tools build v2 user config.jam,修改 configure specific msvc vers...

boost中singleton的實現

在工作中遇到不少情況使用singleton模式,下面採用的是最簡單的一種形式 1class foo2910 private 11 foo 12 這種實現,在單執行緒情況下,簡單而有效。對於執行緒安全的singleton的實現,網上有不少討論。這兩天看到boost庫中的一種實現,沒有使用鎖機制,而是充...

Boost在linux中編譯

用boost 1 39 0版本作為例子 1 進入boost 1 39 0 tools jam src 2 執行.build.sh 或者在boost 1 39 0 tools jam 下執行.build dist.sh 3 編譯完成後在boost 1 39 0 tools jam src bin.li...