Add fourth form of make_unique for objects

To support initialization syntax that Args&&... cannot forward perfectly.
This commit is contained in:
Glen Fernandes
2014-01-29 17:16:01 -08:00
parent f91e7e9ce7
commit 72e5fb6fd7
7 changed files with 95 additions and 37 deletions
@@ -11,6 +11,7 @@
#include <boost/config.hpp>
#include <boost/smart_ptr/detail/up_if_not_array.hpp>
#include <utility>
namespace boost {
template<typename T>
@@ -27,6 +28,12 @@ namespace boost {
}
#endif
template<typename T>
inline typename boost::detail::up_if_not_array<T>::type
make_unique(T&& value) {
return std::unique_ptr<T>(new T(std::move(value)));
}
template<typename T>
inline typename boost::detail::up_if_not_array<T>::type
make_unique_noinit() {