From 4eb8139c8a854a856ce108a0c79a932ab9b6da70 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 17 Mar 2017 13:52:23 +0100 Subject: compat/util: remove our make_unique custom impl --- compat/make-unique.hpp | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 compat/make-unique.hpp (limited to 'compat/make-unique.hpp') diff --git a/compat/make-unique.hpp b/compat/make-unique.hpp deleted file mode 100644 index 64c647b1..00000000 --- a/compat/make-unique.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -// GNU 5.4.0 doesn't have std::make_unique in -std=c++14 mode - -// this implementation was taken from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3656.htm - -#include -#include -#include - -namespace raii_detail { -template struct Unique_if -{ - typedef std::unique_ptr Single_object; -}; - -template struct Unique_if -{ - typedef std::unique_ptr Unknown_bound; -}; - -template struct Unique_if -{ - typedef void Known_bound; -}; -} - -template - typename ::raii_detail::Unique_if::Single_object - make_unique(Args&&... args) { - return std::unique_ptr(new T(std::forward(args)...)); - } - -template - typename ::raii_detail::Unique_if::Unknown_bound - make_unique(std::size_t n) { - typedef typename std::remove_extent::type U; - return std::unique_ptr(new U[n]()); - } - -template - typename ::raii_detail::Unique_if::Known_bound - make_unique(Args&&...) = delete; - -- cgit v1.2.3