Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template< class T > struct TArray
- {
- public:
- T* Data;
- int Count;
- int Max;
- public:
- TArray()
- {
- Data = NULL;
- Count = Max = 0;
- };
- public:
- int Num()
- {
- return this->Count;
- };
- T& operator() (int i)
- {
- return this->Data[i];
- };
- const T& operator() (int i) const
- {
- return this->Data[i];
- };
- void Add(T InputData)
- {
- Data = (T*)realloc(Data, sizeof(T) * (Count + 1));
- Data[Count++] = InputData;
- Max = Count;
- };
- void Clear()
- {
- free(Data);
- Count = Max = 0;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement