mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-09-27 00:01:05 +02:00
Remove uses of boost::is_array
This commit is contained in:
@@ -14,7 +14,6 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
#include <boost/core/first_scalar.hpp>
|
#include <boost/core/first_scalar.hpp>
|
||||||
#include <boost/core/noinit_adaptor.hpp>
|
#include <boost/core/noinit_adaptor.hpp>
|
||||||
#include <boost/core/pointer_traits.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_bounded_array.hpp>
|
||||||
#include <boost/type_traits/is_unbounded_array.hpp>
|
#include <boost/type_traits/is_unbounded_array.hpp>
|
||||||
#include <boost/type_traits/type_identity.hpp>
|
#include <boost/type_traits/type_identity.hpp>
|
||||||
@@ -256,7 +255,7 @@ operator!=(std::nullptr_t,
|
|||||||
template<class A>
|
template<class A>
|
||||||
inline void
|
inline void
|
||||||
sp_alloc_clear(A& a, typename boost::allocator_pointer<A>::type p, std::size_t,
|
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));
|
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>
|
template<class A>
|
||||||
inline void
|
inline void
|
||||||
sp_alloc_clear(A& a, typename boost::allocator_pointer<A>::type p,
|
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 defined(BOOST_MSVC) && BOOST_MSVC < 1800
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@@ -293,7 +292,7 @@ public:
|
|||||||
: base(empty_init_t(), a) { }
|
: base(empty_init_t(), a) { }
|
||||||
|
|
||||||
void operator()(pointer p) {
|
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());
|
base::get().deallocate(p.ptr(), p.size());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -351,7 +350,7 @@ private:
|
|||||||
} /* detail */
|
} /* detail */
|
||||||
|
|
||||||
template<class T, class A>
|
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
|
std::unique_ptr<T, alloc_deleter<T, A> > >::type
|
||||||
allocate_unique(const A& alloc)
|
allocate_unique(const A& alloc)
|
||||||
{
|
{
|
||||||
@@ -361,7 +360,7 @@ allocate_unique(const A& alloc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class A, class... Args>
|
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
|
std::unique_ptr<T, alloc_deleter<T, A> > >::type
|
||||||
allocate_unique(const A& alloc, Args&&... args)
|
allocate_unique(const A& alloc, Args&&... args)
|
||||||
{
|
{
|
||||||
@@ -371,7 +370,7 @@ allocate_unique(const A& alloc, Args&&... args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class A>
|
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
|
std::unique_ptr<T, alloc_deleter<T, A> > >::type
|
||||||
allocate_unique(const A& alloc, typename type_identity<T>::type&& value)
|
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>
|
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
|
std::unique_ptr<T, alloc_deleter<T, noinit_adaptor<A> > > >::type
|
||||||
allocate_unique_noinit(const A& alloc)
|
allocate_unique_noinit(const A& alloc)
|
||||||
{
|
{
|
||||||
|
@@ -8,7 +8,6 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
#ifndef BOOST_SMART_PTR_MAKE_UNIQUE_HPP
|
#ifndef BOOST_SMART_PTR_MAKE_UNIQUE_HPP
|
||||||
#define 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 <boost/type_traits/is_unbounded_array.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@@ -17,28 +16,28 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
template<class T>
|
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()
|
make_unique()
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new T());
|
return std::unique_ptr<T>(new T());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class... Args>
|
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)
|
make_unique(Args&&... args)
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
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)
|
make_unique(typename std::remove_reference<T>::type&& value)
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new T(std::move(value)));
|
return std::unique_ptr<T>(new T(std::move(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
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()
|
make_unique_noinit()
|
||||||
{
|
{
|
||||||
return std::unique_ptr<T>(new T);
|
return std::unique_ptr<T>(new T);
|
||||||
|
Reference in New Issue
Block a user