forked from boostorg/smart_ptr
Use add_rvalue_reference in make_unique overload
This commit is contained in:
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/smart_ptr/detail/up_if_not_array.hpp>
|
#include <boost/smart_ptr/detail/up_if_not_array.hpp>
|
||||||
|
#include <boost/type_traits/add_rvalue_reference.hpp>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
@ -30,7 +31,7 @@ namespace boost {
|
|||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline typename boost::detail::up_if_not_array<T>::type
|
inline typename boost::detail::up_if_not_array<T>::type
|
||||||
make_unique(T&& value) {
|
make_unique(typename add_rvalue_reference<T>::type value) {
|
||||||
return std::unique_ptr<T>(new T(std::move(value)));
|
return std::unique_ptr<T>(new T(std::move(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user