Remove uses of boost::remove_extent

This commit is contained in:
Peter Dimov
2024-10-06 19:26:17 +03:00
parent 9b309184f8
commit 9db2b96843
6 changed files with 16 additions and 19 deletions

View File

@ -116,7 +116,7 @@ template<class T, class A>
inline typename std::enable_if<is_unbounded_array<T>::value, inline typename std::enable_if<is_unbounded_array<T>::value,
local_shared_ptr<T> >::type local_shared_ptr<T> >::type
allocate_local_shared(const A& allocator, std::size_t count, allocate_local_shared(const A& allocator, std::size_t count,
const typename remove_extent<T>::type& value) const typename std::remove_extent<T>::type& value)
{ {
typedef typename detail::sp_array_element<T>::type element; typedef typename detail::sp_array_element<T>::type element;
typedef typename allocator_rebind<A, element>::type other; typedef typename allocator_rebind<A, element>::type other;
@ -137,7 +137,7 @@ template<class T, class A>
inline typename std::enable_if<is_bounded_array<T>::value, inline typename std::enable_if<is_bounded_array<T>::value,
local_shared_ptr<T> >::type local_shared_ptr<T> >::type
allocate_local_shared(const A& allocator, allocate_local_shared(const A& allocator,
const typename remove_extent<T>::type& value) const typename std::remove_extent<T>::type& value)
{ {
enum { enum {
count = std::extent<T>::value count = std::extent<T>::value

View File

@ -15,7 +15,6 @@ Distributed under the Boost Software License, Version 1.0.
#include <boost/type_traits/is_bounded_array.hpp> #include <boost/type_traits/is_bounded_array.hpp>
#include <boost/type_traits/is_unbounded_array.hpp> #include <boost/type_traits/is_unbounded_array.hpp>
#include <boost/type_traits/remove_cv.hpp> #include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_extent.hpp>
#include <boost/type_traits/type_with_alignment.hpp> #include <boost/type_traits/type_with_alignment.hpp>
#include <type_traits> #include <type_traits>
@ -25,7 +24,7 @@ namespace detail {
template<class T> template<class T>
struct sp_array_element { struct sp_array_element {
typedef typename boost::remove_cv<typename typedef typename boost::remove_cv<typename
boost::remove_extent<T>::type>::type type; std::remove_extent<T>::type>::type type;
}; };
template<class T> template<class T>
@ -295,7 +294,7 @@ allocate_shared(const A& allocator)
template<class T, class A> template<class T, class A>
inline typename std::enable_if<is_unbounded_array<T>::value, shared_ptr<T> >::type inline typename std::enable_if<is_unbounded_array<T>::value, shared_ptr<T> >::type
allocate_shared(const A& allocator, std::size_t count, allocate_shared(const A& allocator, std::size_t count,
const typename remove_extent<T>::type& value) const typename std::remove_extent<T>::type& value)
{ {
typedef typename detail::sp_array_element<T>::type element; typedef typename detail::sp_array_element<T>::type element;
typedef typename allocator_rebind<A, element>::type other; typedef typename allocator_rebind<A, element>::type other;
@ -313,7 +312,7 @@ allocate_shared(const A& allocator, std::size_t count,
template<class T, class A> template<class T, class A>
inline typename std::enable_if<is_bounded_array<T>::value, shared_ptr<T> >::type inline typename std::enable_if<is_bounded_array<T>::value, shared_ptr<T> >::type
allocate_shared(const A& allocator, allocate_shared(const A& allocator,
const typename remove_extent<T>::type& value) const typename std::remove_extent<T>::type& value)
{ {
enum { enum {
count = std::extent<T>::value count = std::extent<T>::value

View File

@ -18,7 +18,6 @@ Distributed under the Boost Software License, Version 1.0.
#include <boost/type_traits/is_bounded_array.hpp> #include <boost/type_traits/is_bounded_array.hpp>
#include <boost/type_traits/is_unbounded_array.hpp> #include <boost/type_traits/is_unbounded_array.hpp>
#include <boost/type_traits/remove_cv.hpp> #include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_extent.hpp>
#include <boost/type_traits/type_identity.hpp> #include <boost/type_traits/type_identity.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <memory> #include <memory>
@ -57,7 +56,7 @@ struct sp_alloc_result<T[N]> {
template<class T> template<class T>
struct sp_alloc_value { struct sp_alloc_value {
typedef typename boost::remove_cv<typename typedef typename boost::remove_cv<typename
boost::remove_extent<T>::type>::type type; std::remove_extent<T>::type>::type type;
}; };
template<class T, class P> template<class T, class P>
@ -434,12 +433,12 @@ template<class T, class A>
inline typename std::enable_if<is_unbounded_array<T>::value, inline typename std::enable_if<is_unbounded_array<T>::value,
std::unique_ptr<T, alloc_deleter<T, A> > >::type std::unique_ptr<T, alloc_deleter<T, A> > >::type
allocate_unique(const A& alloc, std::size_t size, allocate_unique(const A& alloc, std::size_t size,
const typename remove_extent<T>::type& value) const typename std::remove_extent<T>::type& value)
{ {
detail::sp_alloc_make<T, A> c(alloc, size); detail::sp_alloc_make<T, A> c(alloc, size);
boost::alloc_construct_n(c.state(), boost::first_scalar(c.get()), boost::alloc_construct_n(c.state(), boost::first_scalar(c.get()),
size * detail::sp_alloc_size<T>::value, boost::first_scalar(&value), size * detail::sp_alloc_size<T>::value, boost::first_scalar(&value),
detail::sp_alloc_size<typename remove_extent<T>::type>::value); detail::sp_alloc_size<typename std::remove_extent<T>::type>::value);
return c.release(); return c.release();
} }
@ -448,12 +447,12 @@ inline typename std::enable_if<is_bounded_array<T>::value,
std::unique_ptr<typename detail::sp_alloc_result<T>::type, std::unique_ptr<typename detail::sp_alloc_result<T>::type,
alloc_deleter<T, A> > >::type alloc_deleter<T, A> > >::type
allocate_unique(const A& alloc, allocate_unique(const A& alloc,
const typename remove_extent<T>::type& value) const typename std::remove_extent<T>::type& value)
{ {
detail::sp_alloc_make<T, A> c(alloc, std::extent<T>::value); detail::sp_alloc_make<T, A> c(alloc, std::extent<T>::value);
boost::alloc_construct_n(c.state(), boost::first_scalar(c.get()), boost::alloc_construct_n(c.state(), boost::first_scalar(c.get()),
detail::sp_alloc_size<T>::value, boost::first_scalar(&value), detail::sp_alloc_size<T>::value, boost::first_scalar(&value),
detail::sp_alloc_size<typename remove_extent<T>::type>::value); detail::sp_alloc_size<typename std::remove_extent<T>::type>::value);
return c.release(); return c.release();
} }

View File

@ -27,7 +27,7 @@ make_local_shared()
template<class T> template<class T>
inline typename std::enable_if<is_bounded_array<T>::value, inline typename std::enable_if<is_bounded_array<T>::value,
local_shared_ptr<T> >::type local_shared_ptr<T> >::type
make_local_shared(const typename remove_extent<T>::type& value) make_local_shared(const typename std::remove_extent<T>::type& value)
{ {
return boost::allocate_local_shared<T>(boost::default_allocator<typename return boost::allocate_local_shared<T>(boost::default_allocator<typename
detail::sp_array_element<T>::type>(), value); detail::sp_array_element<T>::type>(), value);
@ -46,7 +46,7 @@ template<class T>
inline typename std::enable_if<is_unbounded_array<T>::value, inline typename std::enable_if<is_unbounded_array<T>::value,
local_shared_ptr<T> >::type local_shared_ptr<T> >::type
make_local_shared(std::size_t size, make_local_shared(std::size_t size,
const typename remove_extent<T>::type& value) const typename std::remove_extent<T>::type& value)
{ {
return boost::allocate_local_shared<T>(boost::default_allocator<typename return boost::allocate_local_shared<T>(boost::default_allocator<typename
detail::sp_array_element<T>::type>(), size, value); detail::sp_array_element<T>::type>(), size, value);

View File

@ -24,7 +24,7 @@ make_shared()
template<class T> template<class T>
inline typename std::enable_if<is_bounded_array<T>::value, shared_ptr<T> >::type inline typename std::enable_if<is_bounded_array<T>::value, shared_ptr<T> >::type
make_shared(const typename remove_extent<T>::type& value) make_shared(const typename std::remove_extent<T>::type& value)
{ {
return boost::allocate_shared<T>(boost::default_allocator<typename return boost::allocate_shared<T>(boost::default_allocator<typename
detail::sp_array_element<T>::type>(), value); detail::sp_array_element<T>::type>(), value);
@ -40,7 +40,7 @@ make_shared(std::size_t size)
template<class T> template<class T>
inline typename std::enable_if<is_unbounded_array<T>::value, shared_ptr<T> >::type inline typename std::enable_if<is_unbounded_array<T>::value, shared_ptr<T> >::type
make_shared(std::size_t size, const typename remove_extent<T>::type& value) make_shared(std::size_t size, const typename std::remove_extent<T>::type& value)
{ {
return boost::allocate_shared<T>(boost::default_allocator<typename return boost::allocate_shared<T>(boost::default_allocator<typename
detail::sp_array_element<T>::type>(), size, value); detail::sp_array_element<T>::type>(), size, value);

View File

@ -10,7 +10,6 @@ Distributed under the Boost Software License, Version 1.0.
#include <boost/type_traits/is_array.hpp> #include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/is_unbounded_array.hpp> #include <boost/type_traits/is_unbounded_array.hpp>
#include <boost/type_traits/remove_extent.hpp>
#include <memory> #include <memory>
#include <utility> #include <utility>
#include <type_traits> #include <type_traits>
@ -50,7 +49,7 @@ inline typename std::enable_if<is_unbounded_array<T>::value,
std::unique_ptr<T> >::type std::unique_ptr<T> >::type
make_unique(std::size_t size) make_unique(std::size_t size)
{ {
return std::unique_ptr<T>(new typename remove_extent<T>::type[size]()); return std::unique_ptr<T>(new typename std::remove_extent<T>::type[size]());
} }
template<class T> template<class T>
@ -58,7 +57,7 @@ inline typename std::enable_if<is_unbounded_array<T>::value,
std::unique_ptr<T> >::type std::unique_ptr<T> >::type
make_unique_noinit(std::size_t size) make_unique_noinit(std::size_t size)
{ {
return std::unique_ptr<T>(new typename remove_extent<T>::type[size]); return std::unique_ptr<T>(new typename std::remove_extent<T>::type[size]);
} }
} /* boost */ } /* boost */