From 427124543b1b6d5260304ef731b2b331d77c178d Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Fri, 19 Feb 2016 08:09:25 -0500 Subject: [PATCH] Use remove_reference in make_unique implementation --- include/boost/smart_ptr/make_unique.hpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/include/boost/smart_ptr/make_unique.hpp b/include/boost/smart_ptr/make_unique.hpp index 48191b7..d054e3d 100644 --- a/include/boost/smart_ptr/make_unique.hpp +++ b/include/boost/smart_ptr/make_unique.hpp @@ -11,10 +11,7 @@ http://boost.org/LICENSE_1_0.txt #include #include - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include -#endif namespace boost { namespace detail { @@ -38,8 +35,18 @@ struct up_if_array { }; template -struct up_value { - typedef T&& type; +struct up_remove_reference { + typedef T type; +}; + +template +struct up_remove_reference { + typedef T type; +}; + +template +struct up_remove_reference { + typedef T type; }; template @@ -68,7 +75,7 @@ inline typename detail::up_if_object::type template inline typename detail::up_if_object::type - make_unique(typename detail::up_value::type value) + make_unique(typename detail::up_remove_reference::type&& value) { return std::unique_ptr(new T(std::move(value))); }