summaryrefslogtreecommitdiff
path: root/cheat/internal_rewrite/CUtlVector.hpp
blob: 6e43505998e80c05b3156616c88820d08e2452d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once

template <typename T, typename I = int>
class CUtlMemory {
public:
	T* GetBuffer( void ) {
		return m_pMemory;
	}

	int GetAllocationCount( void ) {
		return m_nAllocationCount;
	}

	int GetGrowSize( void ) {
		return m_nGrowSize;
	}

	T* OffsetBufferByIndex( size_t index ) {
		return m_pMemory + index;
	}

private:
	T* m_pMemory;
	int m_nAllocationCount;
	int m_nGrowSize;
};

template <typename T, typename Allocator = CUtlMemory<T>>
class CUtlVector {
public:
	Allocator GetMemory( void ) {
		return m_Memory;
	}

	int GetSize( void ) {
		return m_Size;
	}

	T* GetElements( void ) {
		return m_pElements;
	}

private:
	Allocator m_Memory;
	int m_Size;
	T* m_pElements;
};