summaryrefslogtreecommitdiff
path: root/tnslc/vector.tnsl
blob: 1377938dfbf7df393a274a40ad17e342e8f05c7c (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
struct Vector {
	~void data,
	int
		size,
		count,
		_elsz
}

int VECT_DEFAULT_SIZE = 4

/; method Vector
	
	/; init (int elsz)
		self._elsz = elsz
		self.size = VECT_DEFAULT_SIZE
		self.data = _alloc(elsz * self.size)
		self.count = 0
	;/

	/; get (int index) [~void]
		return self.data
	;/

	/; end
		_delete(self.data)
		self.size = 0
		self._elsz = 0
		self.count = 0
	;/

;/