Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/smart_ptr/make_unique_object.hpp @ 125:34e428693f5d vext
Vext -> Repoint
author | Chris Cannam |
---|---|
date | Thu, 14 Jun 2018 11:15:39 +0100 |
parents | f46d142149f5 |
children |
rev | line source |
---|---|
Chris@102 | 1 /* |
Chris@102 | 2 * Copyright (c) 2014 Glen Joseph Fernandes |
Chris@102 | 3 * glenfe at live dot com |
Chris@102 | 4 * |
Chris@102 | 5 * Distributed under the Boost Software License, |
Chris@102 | 6 * Version 1.0. (See accompanying file LICENSE_1_0.txt |
Chris@102 | 7 * or copy at http://boost.org/LICENSE_1_0.txt) |
Chris@102 | 8 */ |
Chris@102 | 9 #ifndef BOOST_SMART_PTR_MAKE_UNIQUE_OBJECT_HPP |
Chris@102 | 10 #define BOOST_SMART_PTR_MAKE_UNIQUE_OBJECT_HPP |
Chris@102 | 11 |
Chris@102 | 12 #include <boost/config.hpp> |
Chris@102 | 13 #include <boost/smart_ptr/detail/up_if_not_array.hpp> |
Chris@102 | 14 #include <boost/type_traits/add_rvalue_reference.hpp> |
Chris@102 | 15 #include <utility> |
Chris@102 | 16 |
Chris@102 | 17 namespace boost { |
Chris@102 | 18 template<class T> |
Chris@102 | 19 inline typename boost::detail::up_if_not_array<T>::type |
Chris@102 | 20 make_unique() { |
Chris@102 | 21 return std::unique_ptr<T>(new T()); |
Chris@102 | 22 } |
Chris@102 | 23 |
Chris@102 | 24 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) |
Chris@102 | 25 template<class T, class... Args> |
Chris@102 | 26 inline typename boost::detail::up_if_not_array<T>::type |
Chris@102 | 27 make_unique(Args&&... args) { |
Chris@102 | 28 return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); |
Chris@102 | 29 } |
Chris@102 | 30 #endif |
Chris@102 | 31 |
Chris@102 | 32 template<class T> |
Chris@102 | 33 inline typename boost::detail::up_if_not_array<T>::type |
Chris@102 | 34 make_unique(typename add_rvalue_reference<T>::type value) { |
Chris@102 | 35 return std::unique_ptr<T>(new T(std::move(value))); |
Chris@102 | 36 } |
Chris@102 | 37 |
Chris@102 | 38 template<class T> |
Chris@102 | 39 inline typename boost::detail::up_if_not_array<T>::type |
Chris@102 | 40 make_unique_noinit() { |
Chris@102 | 41 return std::unique_ptr<T>(new T); |
Chris@102 | 42 } |
Chris@102 | 43 } |
Chris@102 | 44 |
Chris@102 | 45 #endif |