From c812c92d1a1835f0bda783e709481188c8d92225 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 15 Mar 2014 19:34:59 -0700 Subject: Clean up header organization --- src/compat/memory.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/compat/memory.hpp (limited to 'src/compat/memory.hpp') diff --git a/src/compat/memory.hpp b/src/compat/memory.hpp new file mode 100644 index 0000000..2839640 --- /dev/null +++ b/src/compat/memory.hpp @@ -0,0 +1,27 @@ +#ifndef TMWA_COMPAT_MEMORY_HPP +#define TMWA_COMPAT_MEMORY_HPP + +# include "../sanity.hpp" + +# include + + +template +struct is_array_of_unknown_bound +: std::is_same::type[]> +{}; + +template, class... A> +typename std::enable_if::value, std::unique_ptr>::type make_unique(A&&... a) +{ + return std::unique_ptr(new T(std::forward(a)...)); +} + +template> +typename std::enable_if::value, std::unique_ptr>::type make_unique(size_t sz) +{ + typedef typename std::remove_extent::type E; + return std::unique_ptr(new E[sz]()); +} + +#endif // TMWA_COMPAT_MEMORY_HPP -- cgit v1.2.3-60-g2f50