Simplify implementation in terms of noinit_adaptor

This commit is contained in:
Glen Fernandes
2019-04-28 20:07:12 -04:00
parent 9544a8cb91
commit 442e179920
4 changed files with 75 additions and 206 deletions
@@ -8,6 +8,7 @@ Distributed under the Boost Software License, Version 1.0.
#ifndef BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP
#define BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP
#include <boost/core/default_allocator.hpp>
#include <boost/smart_ptr/allocate_shared_array.hpp>
namespace boost {
@@ -16,7 +17,7 @@ template<class T>
inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type
make_shared()
{
return boost::allocate_shared<T>(std::allocator<typename
return boost::allocate_shared<T>(boost::default_allocator<typename
detail::sp_array_scalar<T>::type>());
}
@@ -24,7 +25,7 @@ template<class T>
inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type
make_shared(const typename remove_extent<T>::type& value)
{
return boost::allocate_shared<T>(std::allocator<typename
return boost::allocate_shared<T>(boost::default_allocator<typename
detail::sp_array_scalar<T>::type>(), value);
}
@@ -32,7 +33,7 @@ template<class T>
inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type
make_shared(std::size_t size)
{
return boost::allocate_shared<T>(std::allocator<typename
return boost::allocate_shared<T>(boost::default_allocator<typename
detail::sp_array_scalar<T>::type>(), size);
}
@@ -40,7 +41,7 @@ template<class T>
inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type
make_shared(std::size_t size, const typename remove_extent<T>::type& value)
{
return boost::allocate_shared<T>(std::allocator<typename
return boost::allocate_shared<T>(boost::default_allocator<typename
detail::sp_array_scalar<T>::type>(), size, value);
}
@@ -48,7 +49,7 @@ template<class T>
inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type
make_shared_noinit()
{
return boost::allocate_shared_noinit<T>(std::allocator<typename
return boost::allocate_shared_noinit<T>(boost::default_allocator<typename
detail::sp_array_scalar<T>::type>());
}
@@ -56,7 +57,7 @@ template<class T>
inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type
make_shared_noinit(std::size_t size)
{
return boost::allocate_shared_noinit<T>(std::allocator<typename
return boost::allocate_shared_noinit<T>(boost::default_allocator<typename
detail::sp_array_scalar<T>::type>(), size);
}