/* 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 namespace boost { template inline typename std::enable_if::value, std::unique_ptr >::type make_unique() { return std::unique_ptr(new T()); } template inline typename std::enable_if::value, std::unique_ptr >::type make_unique(Args&&... args) { return std::unique_ptr(new T(std::forward(args)...)); } template inline typename std::enable_if::value, std::unique_ptr >::type make_unique(typename std::remove_reference::type&& value) { return std::unique_ptr(new T(std::move(value))); } template inline typename std::enable_if::value, std::unique_ptr >::type make_unique_noinit() { return std::unique_ptr(new T); } template inline typename std::enable_if::value, std::unique_ptr >::type make_unique(std::size_t size) { return std::unique_ptr(new typename std::remove_extent::type[size]()); } template inline typename std::enable_if::value, std::unique_ptr >::type make_unique_noinit(std::size_t size) { return std::unique_ptr(new typename std::remove_extent::type[size]); } } /* boost */ #endif