blob: 75c5dd3e3ae8b34959c59057f5f0b4b6523c6da8 (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#ifndef BU_ARRAY_H
#define BU_ARRAY_H
#include <memory>
#include "bu/exceptionbase.h"
namespace Bu
{
/**
* Array type container, just like a normal array only flexible and keeps
* track of your memory for you.
*
*@param value (typename) The type of data to store in your list
*@param valuealloc (typename) Memory Allocator for your value type
*@param linkalloc (typename) Memory Allocator for the list links.
*@ingroup Containers
*/
template<typename value, int inc=10, typename valuealloc=std::allocator<value> >
class Array
{
private:
typedef class Array<value, inc, valuealloc> MyType;
public:
Array() :
pData( NULL ),
iSize( 0 ),
iCapacity( 0 )
{
}
Array( const MyType &src ) :
pData( NULL ),
iSize( 0 ),
iCapacity( 0 )
{
// for( Link *pCur = src.pFirst; pCur; pCur = pCur->pNext )
// {
// append( *pCur->pValue );
// }
}
~Array()
{
clear();
}
/**
* Clear the data from the list.
*/
void clear()
{
}
//operator
/**
* Get the current size of the list.
*@returns (int) The current size of the list.
*/
int getSize() const
{
return iSize;
}
int getCapacity() const
{
return iCapacity;
}
private:
valuealloc va;
value *pData;
int iSize;
int iCapacity;
};
}
#endif
|