RefCountHashMap< K, V, HASH, HANDLER > Class Template Reference Data Structures

#include <refcount_hashmap.h>

详细描述

template<typename K, typename V, typename HASH = DefaultCompare, typename HANDLER = RefCountHashMapDefaultHandler>
class maxon::RefCountHashMap< K, V, HASH, HANDLER >

Use a RefCountHashMap for cache-like use cases where a map entry shall be automatically removed when it isn't used any longer.

To add an entry to a RefCountHashMap , you have to use and store an EntryRef as in

EntryRef ref; Bool created; V* value = ref.Set(map, key, created) iferr_return ;

This will add an entry for key , and this entry will stay in the map as long as there are EntryRefs pointing to it. The map keeps track of those entries by means of reference counting.

Classes

class   Entry
class   EntryRef

Public Types

using  Map = HashMap < K, Entry , HASH >

公共成员函数

  ~RefCountHashMap ()
String   ToString (const FormatStatement *fmt=nullptr) const
Map GetMap ()
const Map GetMap () const

Private Attributes

Map   _map

Member Typedef Documentation

◆  Map

using Map = HashMap <K, Entry , HASH>

构造函数 & 析构函数文档编制

◆  ~RefCountHashMap()

~ RefCountHashMap ( )

成员函数文档编制

◆  ToString()

String ToString ( const FormatStatement fmt = nullptr ) const

◆  GetMap() [1/2]

Map & GetMap ( )

◆  GetMap() [2/2]

const Map & GetMap ( ) const

Member Data Documentation

◆  _map

Map _map
private
iferr_return
#define iferr_return
定义: resultbase.h:1434
Bool
maxon::Bool Bool
定义: ge_sys_math.h:53