Remove uses of boost::is_array

This commit is contained in:
Peter Dimov
2024-10-06 19:35:07 +03:00
parent 173cf9ad7b
commit 0bedddbf16
2 changed files with 11 additions and 13 deletions

View File

@@ -14,7 +14,6 @@ Distributed under the Boost Software License, Version 1.0.
#include <boost/core/first_scalar.hpp>
#include <boost/core/noinit_adaptor.hpp>
#include <boost/core/pointer_traits.hpp>
#include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/is_bounded_array.hpp>
#include <boost/type_traits/is_unbounded_array.hpp>
#include <boost/type_traits/type_identity.hpp>
@@ -256,7 +255,7 @@ operator!=(std::nullptr_t,
template<class A>
inline void
sp_alloc_clear(A& a, typename boost::allocator_pointer<A>::type p, std::size_t,
boost::false_type)
std::false_type)
{
boost::alloc_destroy(a, boost::to_address(p));
}
@@ -264,7 +263,7 @@ sp_alloc_clear(A& a, typename boost::allocator_pointer<A>::type p, std::size_t,
template<class A>
inline void
sp_alloc_clear(A& a, typename boost::allocator_pointer<A>::type p,
std::size_t n, boost::true_type)
std::size_t n, std::true_type)
{
#if defined(BOOST_MSVC) && BOOST_MSVC < 1800
if (!p) {
@@ -293,7 +292,7 @@ public:
: base(empty_init_t(), a) { }
void operator()(pointer p) {
detail::sp_alloc_clear(base::get(), p.ptr(), p.size(), is_array<T>());
detail::sp_alloc_clear(base::get(), p.ptr(), p.size(), std::is_array<T>());
base::get().deallocate(p.ptr(), p.size());
}
};
@@ -351,7 +350,7 @@ private:
} /* detail */
template<class T, class A>
inline typename std::enable_if<!is_array<T>::value,
inline typename std::enable_if<!std::is_array<T>::value,
std::unique_ptr<T, alloc_deleter<T, A> > >::type
allocate_unique(const A& alloc)
{
@@ -361,7 +360,7 @@ allocate_unique(const A& alloc)
}
template<class T, class A, class... Args>
inline typename std::enable_if<!is_array<T>::value,
inline typename std::enable_if<!std::is_array<T>::value,
std::unique_ptr<T, alloc_deleter<T, A> > >::type
allocate_unique(const A& alloc, Args&&... args)
{
@@ -371,7 +370,7 @@ allocate_unique(const A& alloc, Args&&... args)
}
template<class T, class A>
inline typename std::enable_if<!is_array<T>::value,
inline typename std::enable_if<!std::is_array<T>::value,
std::unique_ptr<T, alloc_deleter<T, A> > >::type
allocate_unique(const A& alloc, typename type_identity<T>::type&& value)
{
@@ -381,7 +380,7 @@ allocate_unique(const A& alloc, typename type_identity<T>::type&& value)
}
template<class T, class A>
inline typename std::enable_if<!is_array<T>::value,
inline typename std::enable_if<!std::is_array<T>::value,
std::unique_ptr<T, alloc_deleter<T, noinit_adaptor<A> > > >::type
allocate_unique_noinit(const A& alloc)
{

View File

@@ -8,7 +8,6 @@ Distributed under the Boost Software License, Version 1.0.
#ifndef BOOST_SMART_PTR_MAKE_UNIQUE_HPP
#define BOOST_SMART_PTR_MAKE_UNIQUE_HPP
#include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/is_unbounded_array.hpp>
#include <memory>
#include <utility>
@@ -17,28 +16,28 @@ Distributed under the Boost Software License, Version 1.0.
namespace boost {
template<class T>
inline typename std::enable_if<!is_array<T>::value, std::unique_ptr<T> >::type
inline typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T> >::type
make_unique()
{
return std::unique_ptr<T>(new T());
}
template<class T, class... Args>
inline typename std::enable_if<!is_array<T>::value, std::unique_ptr<T> >::type
inline typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T> >::type
make_unique(Args&&... args)
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template<class T>
inline typename std::enable_if<!is_array<T>::value, std::unique_ptr<T> >::type
inline typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T> >::type
make_unique(typename std::remove_reference<T>::type&& value)
{
return std::unique_ptr<T>(new T(std::move(value)));
}
template<class T>
inline typename std::enable_if<!is_array<T>::value, std::unique_ptr<T> >::type
inline typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T> >::type
make_unique_noinit()
{
return std::unique_ptr<T>(new T);