YSTest  PreAlpha_b500_20140530
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc > 模板类 参考

按最近最多使用策略刷新的缓存。 更多...

#include <Cache.hpp>

类 YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc > 继承关系图:
YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc > 的协作图:

Public 类型

using Map = unordered_map< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >
 
using UseList = list< _tKey, _tAlloc >
 
using UseCache = unordered_multimap< _tKey, typename UseList::iterator, _fHash, _fEqual, _tAlloc >
 

Public 成员函数

 GMRUCache (size_type s=15U)
 
 DefDeMoveCtor (GMRUCache) private
 
 DefGetter (const ynothrow, size_type, MaxUse, max_use) void SetMaxUse(size_type s)
 
void clear () ynoexcept
 
template<typename... _tParams>
pair< typename Map::iterator,
bool > 
emplace (_tParams &&...args)
 
iterator find (const key_type &k)
 
const_iterator find (const key_type &k) const
 

Private 属性

UseList use_list
 
UseCache use_cache
 
size_type max_use
 保持可以再增加一个缓存项的最大容量。 更多...
 

详细描述

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
class YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >

按最近最多使用策略刷新的缓存。

自从
build 461
待办事项:

加入异常安全的复制构造函数。

扩展为 MLU 列表。

在文件 Cache.hpp48 行定义.

成员类型定义说明

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
using YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::Map = unordered_map<_tKey, _tMapped, _fHash, _fEqual, _tAlloc>

在文件 Cache.hpp52 行定义.

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
using YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::UseCache = unordered_multimap<_tKey, typename UseList::iterator, _fHash, _fEqual, _tAlloc>

在文件 Cache.hpp55 行定义.

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
using YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::UseList = list<_tKey, _tAlloc>

在文件 Cache.hpp53 行定义.

构造及析构函数说明

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::GMRUCache ( size_type  s = 15U)
inlineexplicit

在文件 Cache.hpp69 行定义.

成员函数说明

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
void YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::clear ( )
inline

在文件 Cache.hpp105 行定义.

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::DefDeMoveCtor ( GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >  )
inline

在文件 Cache.hpp72 行定义.

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::DefGetter ( const ynothrow  ,
size_type  ,
MaxUse  ,
max_use   
)
inline

在文件 Cache.hpp92 行定义.

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
template<typename... _tParams>
pair<typename Map::iterator, bool> YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::emplace ( _tParams &&...  args)
inline

在文件 Cache.hpp116 行定义.

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
iterator YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::find ( const key_type &  k)
inline

在文件 Cache.hpp146 行定义.

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
const_iterator YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::find ( const key_type &  k) const
inline

在文件 Cache.hpp158 行定义.

类成员变量说明

template<typename _tKey, typename _tMapped, typename _fHash = std::hash<_tKey>, typename _fEqual = std::equal_to<_tKey>, class _tAlloc = std::allocator<pair<const _tKey, _tMapped>>>
size_type YSLib::GMRUCache< _tKey, _tMapped, _fHash, _fEqual, _tAlloc >::max_use
private

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