summaryrefslogtreecommitdiff
path: root/Utils/allocator.h
diff options
context:
space:
mode:
Diffstat (limited to 'Utils/allocator.h')
-rw-r--r--Utils/allocator.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/Utils/allocator.h b/Utils/allocator.h
new file mode 100644
index 0000000..8b0fdb6
--- /dev/null
+++ b/Utils/allocator.h
@@ -0,0 +1,13 @@
+#ifndef __ALLOCATOR_H__
+#define __ALLOCATOR_H__
+
+#include <stdlib.h>
+
+template<class T>
+class Allocator {
+ public:
+ static T * alloc(int n) { return (T*) calloc(n, sizeof(T)); };
+ static void free(T * & ptr) { free(ptr); ptr = 0; }
+};
+
+#endif