/* Copyright 2012-2019 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_SMART_PTR_MAKE_UNIQUE_HPP #define BOOST_SMART_PTR_MAKE_UNIQUE_HPP #include #include #include #include #include #include #include namespace boost { template inline typename enable_if_::value, std::unique_ptr >::type make_unique() { return std::unique_ptr(new T()); } #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template inline typename enable_if_::value, std::unique_ptr >::type make_unique(Args&&... args) { return std::unique_ptr(new T(std::forward(args)...)); } #endif template inline typename enable_if_::value, std::unique_ptr >::type make_unique(typename remove_reference::type&& value) { return std::unique_ptr(new T(std::move(value))); } template inline typename enable_if_::value, std::unique_ptr >::type make_unique_noinit() { return std::unique_ptr(new T); } template inline typename enable_if_::value, std::unique_ptr >::type make_unique(std::size_t size) { return std::unique_ptr(new typename remove_extent::type[size]()); } template inline typename enable_if_::value, std::unique_ptr >::type make_unique_noinit(std::size_t size) { return std::unique_ptr(new typename remove_extent::type[size]); } } /* boost */ #endif