summaryrefslogtreecommitdiff
path: root/src/include/tome/make_array.hpp
blob: ac0edb808dc4785eab0b0903e234672f33704462 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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;
}