aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Common/Array.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Common/Array.hpp')
-rw-r--r--src/libjin/Common/Array.hpp83
1 files changed, 0 insertions, 83 deletions
diff --git a/src/libjin/Common/Array.hpp b/src/libjin/Common/Array.hpp
deleted file mode 100644
index 45082db..0000000
--- a/src/libjin/Common/Array.hpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef __LIBJIN_COMMON_ARRAY_H
-#define __LIBJIN_COMMON_ARRAY_H
-
-namespace jin
-{
-
- /* ԶͷŶڴջϴĶ̬ */
- template<typename T>
- class Array
- {
- public:
- Array() : length(0), data(nullptr) {}
-
- Array(int l)
- {
- length = l;
- data = new T[l];
- }
-
- ~Array()
- {
- delete[] data;
- length = 0;
- }
-
- T* operator &()
- {
- return data;
- }
-
- T& operator[](int index)
- {
- return data[index];
- }
-
- /* ڴ */
- void bind(T* d, int len)
- {
- if (data != nullptr)
- delete data;
- data = d;
- length = len;
- }
-
- void add(T v)
- {
- int len = length + 1;
- T* d = new T[len];
- memcpy(d, data, size());
- d[length] = v;
- bind(d, len);
- }
-
- int size()
- {
- return sizeof(T) * length;
- }
-
- int count()
- {
- return length;
- }
-
- private:
- /**
- * http://blog.jobbole.com/106923/
- * new ڴ洴
- * 1. new ڴ
- * 2. ù캯
- *
- * new, deleteڷͷڴ棬
- */
- void* operator new(size_t t);
- void operator delete(void* ptr);
-
- T * data;
- unsigned int length;
-
- };
-
-}
-
-#endif \ No newline at end of file