summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2013-03-26 17:10:10 +0100
committerBardur Arantsson <bardur@scientician.net>2013-09-27 14:46:42 +0200
commitcbef37bd5bfb938a2303ee3887520c08be85d8e8 (patch)
treeb604e49323e46af4ea582f9a9e1977b3daa90611 /src/include
parentb9f824effb037a53556e02955cace6c09ff646c3 (diff)
Switch almost everything over to C++
Diffstat (limited to 'src/include')
-rw-r--r--src/include/tome/make_array.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/include/tome/make_array.hpp b/src/include/tome/make_array.hpp
new file mode 100644
index 00000000..ac0edb80
--- /dev/null
+++ b/src/include/tome/make_array.hpp
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <type_traits>
+
+/*
+ * Make an array of a POD type.
+ */
+template <typename T> T *make_array(size_t n) {
+ static_assert(std::is_pod<T>::value, "Type parameter must be POD type");
+ T *array = new T[n];
+ memset(array, 0, n*sizeof(T));
+ return array;
+}