YSTest  PreAlpha_b400_20130424
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
ystdex::nifty_counter< _type, _tCount > 模板类 参考

使用引用计数的静态初始化管理器。 更多...

#include <utility.hpp>

Public 类型

typedef _type object_type
 
typedef _tCount count_type
 

Public 成员函数

template<typename... _tParams>
 nifty_counter (_tParams &&...args)
 
 ~nifty_counter ()
 

静态 Public 成员函数

static object_typeget ()
 
static count_type use_count ()
 

静态 Private 成员函数

static count_typeget_count ()
 
static object_type *& get_object_ptr ()
 

详细描述

template<class _type, typename _tCount = size_t>
class ystdex::nifty_counter< _type, _tCount >

使用引用计数的静态初始化管理器。

参见
http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Nifty_Counter
警告
非线程安全。
自从
build 328

静态初始化,通过引用计数保证所有在定义本类型的对象后已有静态对象被初始化。 在所有翻译单元的本类型对象析构后自动反初始化。

在文件 utility.hpp268 行定义.

成员类型定义说明

template<class _type , typename _tCount = size_t>
typedef _tCount ystdex::nifty_counter< _type, _tCount >::count_type

在文件 utility.hpp272 行定义.

template<class _type , typename _tCount = size_t>
typedef _type ystdex::nifty_counter< _type, _tCount >::object_type

在文件 utility.hpp271 行定义.

构造及析构函数说明

template<class _type , typename _tCount = size_t>
template<typename... _tParams>
ystdex::nifty_counter< _type, _tCount >::nifty_counter ( _tParams &&...  args)
inline
template<class _type , typename _tCount = size_t>
ystdex::nifty_counter< _type, _tCount >::~nifty_counter ( )
inline

成员函数说明

template<class _type , typename _tCount = size_t>
static object_type& ystdex::nifty_counter< _type, _tCount >::get ( )
inlinestatic

在文件 utility.hpp287 行定义.

参考 ystdex::nifty_counter< _type, _tCount >::get_object_ptr() , 以及 yassume.

函数调用图:

template<class _type , typename _tCount = size_t>
static count_type& ystdex::nifty_counter< _type, _tCount >::get_count ( )
inlinestaticprivate
template<class _type , typename _tCount = size_t>
static object_type*& ystdex::nifty_counter< _type, _tCount >::get_object_ptr ( )
inlinestaticprivate
template<class _type , typename _tCount = size_t>
static count_type ystdex::nifty_counter< _type, _tCount >::use_count ( )
inlinestatic

在文件 utility.hpp312 行定义.

参考 ystdex::nifty_counter< _type, _tCount >::get_count().

函数调用图:


该类的文档由以下文件生成: