mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-29 20:37:13 +02:00
Remove uses of boost::enable_if_
This commit is contained in:
@ -10,6 +10,7 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/smart_ptr/allocate_shared_array.hpp>
|
||||
#include <boost/smart_ptr/local_shared_ptr.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
@ -69,7 +70,7 @@ private:
|
||||
} /* detail */
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<is_unbounded_array<T>::value,
|
||||
inline typename std::enable_if<is_unbounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
allocate_local_shared(const A& allocator, std::size_t count)
|
||||
{
|
||||
@ -89,7 +90,7 @@ allocate_local_shared(const A& allocator, std::size_t count)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<is_bounded_array<T>::value,
|
||||
inline typename std::enable_if<is_bounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
allocate_local_shared(const A& allocator)
|
||||
{
|
||||
@ -112,7 +113,7 @@ allocate_local_shared(const A& allocator)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<is_unbounded_array<T>::value,
|
||||
inline typename std::enable_if<is_unbounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
allocate_local_shared(const A& allocator, std::size_t count,
|
||||
const typename remove_extent<T>::type& value)
|
||||
@ -133,7 +134,7 @@ allocate_local_shared(const A& allocator, std::size_t count,
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<is_bounded_array<T>::value,
|
||||
inline typename std::enable_if<is_bounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
allocate_local_shared(const A& allocator,
|
||||
const typename remove_extent<T>::type& value)
|
||||
@ -157,7 +158,7 @@ allocate_local_shared(const A& allocator,
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<is_unbounded_array<T>::value,
|
||||
inline typename std::enable_if<is_unbounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
allocate_local_shared_noinit(const A& allocator, std::size_t count)
|
||||
{
|
||||
@ -166,7 +167,7 @@ allocate_local_shared_noinit(const A& allocator, std::size_t count)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<is_bounded_array<T>::value,
|
||||
inline typename std::enable_if<is_bounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
allocate_local_shared_noinit(const A& allocator)
|
||||
{
|
||||
|
@ -12,7 +12,6 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
#include <boost/core/alloc_construct.hpp>
|
||||
#include <boost/core/first_scalar.hpp>
|
||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||
#include <boost/type_traits/enable_if.hpp>
|
||||
#include <boost/type_traits/extent.hpp>
|
||||
#include <boost/type_traits/is_bounded_array.hpp>
|
||||
#include <boost/type_traits/is_unbounded_array.hpp>
|
||||
@ -258,7 +257,7 @@ private:
|
||||
} /* detail */
|
||||
|
||||
template<class T, class A>
|
||||
inline typename 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)
|
||||
{
|
||||
typedef typename detail::sp_array_element<T>::type element;
|
||||
@ -275,7 +274,7 @@ allocate_shared(const A& allocator, std::size_t count)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename 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)
|
||||
{
|
||||
enum {
|
||||
@ -295,7 +294,7 @@ allocate_shared(const A& allocator)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename 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,
|
||||
const typename remove_extent<T>::type& value)
|
||||
{
|
||||
@ -313,7 +312,7 @@ allocate_shared(const A& allocator, std::size_t count,
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename 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,
|
||||
const typename remove_extent<T>::type& value)
|
||||
{
|
||||
@ -334,14 +333,14 @@ allocate_shared(const A& allocator,
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename 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_noinit(const A& allocator, std::size_t count)
|
||||
{
|
||||
return boost::allocate_shared<T>(boost::noinit_adapt(allocator), count);
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename 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_noinit(const A& allocator)
|
||||
{
|
||||
return boost::allocate_shared<T>(boost::noinit_adapt(allocator));
|
||||
|
@ -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/enable_if.hpp>
|
||||
#include <boost/type_traits/extent.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/is_bounded_array.hpp>
|
||||
@ -26,6 +25,7 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
@ -354,7 +354,7 @@ private:
|
||||
} /* detail */
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<!is_array<T>::value,
|
||||
inline typename std::enable_if<!is_array<T>::value,
|
||||
std::unique_ptr<T, alloc_deleter<T, A> > >::type
|
||||
allocate_unique(const A& alloc)
|
||||
{
|
||||
@ -364,7 +364,7 @@ allocate_unique(const A& alloc)
|
||||
}
|
||||
|
||||
template<class T, class A, class... Args>
|
||||
inline typename enable_if_<!is_array<T>::value,
|
||||
inline typename std::enable_if<!is_array<T>::value,
|
||||
std::unique_ptr<T, alloc_deleter<T, A> > >::type
|
||||
allocate_unique(const A& alloc, Args&&... args)
|
||||
{
|
||||
@ -374,7 +374,7 @@ allocate_unique(const A& alloc, Args&&... args)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<!is_array<T>::value,
|
||||
inline typename std::enable_if<!is_array<T>::value,
|
||||
std::unique_ptr<T, alloc_deleter<T, A> > >::type
|
||||
allocate_unique(const A& alloc, typename type_identity<T>::type&& value)
|
||||
{
|
||||
@ -384,7 +384,7 @@ allocate_unique(const A& alloc, typename type_identity<T>::type&& value)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<!is_array<T>::value,
|
||||
inline typename std::enable_if<!is_array<T>::value,
|
||||
std::unique_ptr<T, alloc_deleter<T, noinit_adaptor<A> > > >::type
|
||||
allocate_unique_noinit(const A& alloc)
|
||||
{
|
||||
@ -392,7 +392,7 @@ allocate_unique_noinit(const A& alloc)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename 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
|
||||
allocate_unique(const A& alloc, std::size_t size)
|
||||
{
|
||||
@ -403,7 +403,7 @@ allocate_unique(const A& alloc, std::size_t size)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<is_bounded_array<T>::value,
|
||||
inline typename std::enable_if<is_bounded_array<T>::value,
|
||||
std::unique_ptr<typename detail::sp_alloc_result<T>::type,
|
||||
alloc_deleter<T, A> > >::type
|
||||
allocate_unique(const A& alloc)
|
||||
@ -415,7 +415,7 @@ allocate_unique(const A& alloc)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<is_unbounded_array<T>::value,
|
||||
inline typename std::enable_if<is_unbounded_array<T>::value,
|
||||
std::unique_ptr<T, alloc_deleter<T, noinit_adaptor<A> > > >::type
|
||||
allocate_unique_noinit(const A& alloc, std::size_t size)
|
||||
{
|
||||
@ -423,7 +423,7 @@ allocate_unique_noinit(const A& alloc, std::size_t size)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<is_bounded_array<T>::value,
|
||||
inline typename std::enable_if<is_bounded_array<T>::value,
|
||||
std::unique_ptr<typename detail::sp_alloc_result<T>::type,
|
||||
alloc_deleter<T, noinit_adaptor<A> > > >::type
|
||||
allocate_unique_noinit(const A& alloc)
|
||||
@ -432,7 +432,7 @@ allocate_unique_noinit(const A& alloc)
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename 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
|
||||
allocate_unique(const A& alloc, std::size_t size,
|
||||
const typename remove_extent<T>::type& value)
|
||||
@ -445,7 +445,7 @@ allocate_unique(const A& alloc, std::size_t size,
|
||||
}
|
||||
|
||||
template<class T, class A>
|
||||
inline typename enable_if_<is_bounded_array<T>::value,
|
||||
inline typename std::enable_if<is_bounded_array<T>::value,
|
||||
std::unique_ptr<typename detail::sp_alloc_result<T>::type,
|
||||
alloc_deleter<T, A> > >::type
|
||||
allocate_unique(const A& alloc,
|
||||
|
@ -11,11 +11,12 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/core/default_allocator.hpp>
|
||||
#include <boost/smart_ptr/allocate_local_shared_array.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T>
|
||||
inline typename enable_if_<is_bounded_array<T>::value,
|
||||
inline typename std::enable_if<is_bounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
make_local_shared()
|
||||
{
|
||||
@ -24,7 +25,7 @@ make_local_shared()
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename enable_if_<is_bounded_array<T>::value,
|
||||
inline typename std::enable_if<is_bounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
make_local_shared(const typename remove_extent<T>::type& value)
|
||||
{
|
||||
@ -33,7 +34,7 @@ make_local_shared(const typename remove_extent<T>::type& value)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename enable_if_<is_unbounded_array<T>::value,
|
||||
inline typename std::enable_if<is_unbounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
make_local_shared(std::size_t size)
|
||||
{
|
||||
@ -42,7 +43,7 @@ make_local_shared(std::size_t size)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename enable_if_<is_unbounded_array<T>::value,
|
||||
inline typename std::enable_if<is_unbounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
make_local_shared(std::size_t size,
|
||||
const typename remove_extent<T>::type& value)
|
||||
@ -52,7 +53,7 @@ make_local_shared(std::size_t size,
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename enable_if_<is_bounded_array<T>::value,
|
||||
inline typename std::enable_if<is_bounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
make_local_shared_noinit()
|
||||
{
|
||||
@ -61,7 +62,7 @@ make_local_shared_noinit()
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename enable_if_<is_unbounded_array<T>::value,
|
||||
inline typename std::enable_if<is_unbounded_array<T>::value,
|
||||
local_shared_ptr<T> >::type
|
||||
make_local_shared_noinit(std::size_t size)
|
||||
{
|
||||
|
@ -10,11 +10,12 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/core/default_allocator.hpp>
|
||||
#include <boost/smart_ptr/allocate_shared_array.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T>
|
||||
inline typename 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()
|
||||
{
|
||||
return boost::allocate_shared<T>(boost::default_allocator<typename
|
||||
@ -22,7 +23,7 @@ make_shared()
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename 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)
|
||||
{
|
||||
return boost::allocate_shared<T>(boost::default_allocator<typename
|
||||
@ -30,7 +31,7 @@ make_shared(const typename remove_extent<T>::type& value)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename 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)
|
||||
{
|
||||
return boost::allocate_shared<T>(boost::default_allocator<typename
|
||||
@ -38,7 +39,7 @@ make_shared(std::size_t size)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename 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)
|
||||
{
|
||||
return boost::allocate_shared<T>(boost::default_allocator<typename
|
||||
@ -46,7 +47,7 @@ make_shared(std::size_t size, const typename remove_extent<T>::type& value)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename 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_noinit()
|
||||
{
|
||||
return boost::allocate_shared_noinit<T>(boost::default_allocator<typename
|
||||
@ -54,7 +55,7 @@ make_shared_noinit()
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename 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_noinit(std::size_t size)
|
||||
{
|
||||
return boost::allocate_shared_noinit<T>(boost::default_allocator<typename
|
||||
|
@ -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/enable_if.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/is_unbounded_array.hpp>
|
||||
#include <boost/type_traits/remove_extent.hpp>
|
||||
@ -19,35 +18,35 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
namespace boost {
|
||||
|
||||
template<class T>
|
||||
inline typename enable_if_<!is_array<T>::value, std::unique_ptr<T> >::type
|
||||
inline typename std::enable_if<!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 enable_if_<!is_array<T>::value, std::unique_ptr<T> >::type
|
||||
inline typename std::enable_if<!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 enable_if_<!is_array<T>::value, std::unique_ptr<T> >::type
|
||||
inline typename std::enable_if<!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 enable_if_<!is_array<T>::value, std::unique_ptr<T> >::type
|
||||
inline typename std::enable_if<!is_array<T>::value, std::unique_ptr<T> >::type
|
||||
make_unique_noinit()
|
||||
{
|
||||
return std::unique_ptr<T>(new T);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename enable_if_<is_unbounded_array<T>::value,
|
||||
inline typename std::enable_if<is_unbounded_array<T>::value,
|
||||
std::unique_ptr<T> >::type
|
||||
make_unique(std::size_t size)
|
||||
{
|
||||
@ -55,7 +54,7 @@ make_unique(std::size_t size)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename enable_if_<is_unbounded_array<T>::value,
|
||||
inline typename std::enable_if<is_unbounded_array<T>::value,
|
||||
std::unique_ptr<T> >::type
|
||||
make_unique_noinit(std::size_t size)
|
||||
{
|
||||
|
Reference in New Issue
Block a user