CommonLibVR
NiTMap.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "RE/N/NiTMapBase.h"
5 
6 namespace RE
7 {
8  template <class Key, class T>
9  class NiTMap : public NiTMapBase<NiTDefaultAllocator<NiTMapItem<Key, T>>, Key, T>
10  {
11  private:
13 
14  public:
15  using key_type = typename Base::key_type;
16  using mapped_type = typename Base::mapped_type;
17  using value_type = typename Base::value_type;
18  using size_type = typename Base::size_type;
19 
20  NiTMap(std::uint32_t a_hashSize = 37) :
21  Base(a_hashSize)
22  {}
23 
24  ~NiTMap() override // 00
25  {}
26 
27  protected:
28  using Base::_allocator;
29 
30  // override (NiTMapBase)
31  value_type* malloc_value() override // 05
32  {
33  return static_cast<value_type*>(_allocator.Allocate());
34  }
35 
36  void free_value(value_type* a_value) override // 06
37  {
38  if (a_value) {
39  a_value->~value_type();
40  _allocator.Deallocate(a_value);
41  }
42  }
43 
44  private:
45  KEEP_FOR_RE()
46  };
47  static_assert(sizeof(NiTMap<void*, void*>) == 0x20);
48 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: NiTMapBase.h:24
AntiBloatAllocator _allocator
Definition: NiTMapBase.h:370
NiTMapItem< Key, T > value_type
Definition: NiTMapBase.h:32
Definition: NiTMap.h:10
void free_value(value_type *a_value) override
Definition: NiTMap.h:36
typename Base::key_type key_type
Definition: NiTMap.h:15
value_type * malloc_value() override
Definition: NiTMap.h:31
~NiTMap() override
Definition: NiTMap.h:24
NiTMap(std::uint32_t a_hashSize=37)
Definition: NiTMap.h:20
typename Base::size_type size_type
Definition: NiTMap.h:18
typename Base::mapped_type mapped_type
Definition: NiTMap.h:16
typename Base::value_type value_type
Definition: NiTMap.h:17
Definition: AbsorbEffect.h:6