2 * Copyright (c) 2014 Glen Joseph Fernandes
3 * glenfe at live dot com
5 * Distributed under the Boost Software License,
6 * Version 1.0. (See accompanying file LICENSE_1_0.txt
7 * or copy at http://boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_SMART_PTR_MAKE_UNIQUE_OBJECT_HPP
10 #define BOOST_SMART_PTR_MAKE_UNIQUE_OBJECT_HPP
12 #include <boost/config.hpp>
13 #include <boost/smart_ptr/detail/up_if_not_array.hpp>
14 #include <boost/type_traits/add_rvalue_reference.hpp>
19 inline typename boost::detail::up_if_not_array<T>::type
21 return std::unique_ptr<T>(new T());
24 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
25 template<class T, class... Args>
26 inline typename boost::detail::up_if_not_array<T>::type
27 make_unique(Args&&... args) {
28 return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
33 inline typename boost::detail::up_if_not_array<T>::type
34 make_unique(typename add_rvalue_reference<T>::type value) {
35 return std::unique_ptr<T>(new T(std::move(value)));
39 inline typename boost::detail::up_if_not_array<T>::type
40 make_unique_noinit() {
41 return std::unique_ptr<T>(new T);