mirror of
https://github.com/boostorg/move.git
synced 2025-08-02 21:54:26 +02:00
Merge branch 'develop'
This commit is contained in:
@@ -25,10 +25,15 @@
|
|||||||
//! This header can be a bit heavyweight in C++03 compilers due to the use of the
|
//! This header can be a bit heavyweight in C++03 compilers due to the use of the
|
||||||
//! preprocessor library, that's why it's a a separate header from <tt>unique_ptr.hpp</tt>
|
//! preprocessor library, that's why it's a a separate header from <tt>unique_ptr.hpp</tt>
|
||||||
|
|
||||||
namespace boost{
|
|
||||||
|
|
||||||
#if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
|
#if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
|
||||||
|
|
||||||
|
namespace std { //no namespace versioning in clang+libc++
|
||||||
|
|
||||||
|
struct nothrow_t;
|
||||||
|
|
||||||
|
} //namespace std {
|
||||||
|
|
||||||
|
namespace boost{
|
||||||
namespace move_upmu {
|
namespace move_upmu {
|
||||||
|
|
||||||
//Compile time switch between
|
//Compile time switch between
|
||||||
@@ -52,10 +57,14 @@ struct unique_ptr_if<T[N]>
|
|||||||
typedef void t_is_array_of_known_bound;
|
typedef void t_is_array_of_known_bound;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static std::nothrow_t *pnothrow;
|
||||||
|
|
||||||
} //namespace move_upmu {
|
} //namespace move_upmu {
|
||||||
|
} //namespace boost{
|
||||||
|
|
||||||
#endif //!defined(BOOST_MOVE_DOXYGEN_INVOKED)
|
#endif //!defined(BOOST_MOVE_DOXYGEN_INVOKED)
|
||||||
|
|
||||||
|
namespace boost{
|
||||||
namespace movelib {
|
namespace movelib {
|
||||||
|
|
||||||
#if defined(BOOST_MOVE_DOXYGEN_INVOKED) || !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#if defined(BOOST_MOVE_DOXYGEN_INVOKED) || !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
@@ -69,6 +78,15 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
make_unique(BOOST_FWD_REF(Args)... args)
|
make_unique(BOOST_FWD_REF(Args)... args)
|
||||||
{ return unique_ptr<T>(new T(::boost::forward<Args>(args)...)); }
|
{ return unique_ptr<T>(new T(::boost::forward<Args>(args)...)); }
|
||||||
|
|
||||||
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is not an array.
|
||||||
|
//!
|
||||||
|
//! <b>Returns</b>: <tt>unique_ptr<T>(new T(std::nothrow)(std::forward<Args>(args)...))</tt>.
|
||||||
|
template<class T, class... Args>
|
||||||
|
inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array)
|
||||||
|
make_unique_nothrow(BOOST_FWD_REF(Args)... args)
|
||||||
|
{ return unique_ptr<T>(new (*boost::move_upmu::pnothrow)T(::boost::forward<Args>(args)...)); }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
//0 arg
|
//0 arg
|
||||||
@@ -76,6 +94,12 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
make_unique()
|
make_unique()
|
||||||
{ return unique_ptr<T>(new T()); }
|
{ return unique_ptr<T>(new T()); }
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow()
|
||||||
|
{ return unique_ptr<T>(new (*boost::move_upmu::pnothrow)T()); }
|
||||||
|
|
||||||
//1 arg
|
//1 arg
|
||||||
template<class T, class P0>
|
template<class T, class P0>
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
@@ -87,6 +111,17 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class P0>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow( BOOST_FWD_REF(P0) p0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return unique_ptr<T>
|
||||||
|
( new (*boost::move_upmu::pnothrow)T ( ::boost::forward<P0>(p0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
//2 arg
|
//2 arg
|
||||||
template<class T, class P0, class P1>
|
template<class T, class P0, class P1>
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
@@ -100,6 +135,19 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class P0, class P1>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow( BOOST_FWD_REF(P0) p0
|
||||||
|
, BOOST_FWD_REF(P1) p1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return unique_ptr<T>
|
||||||
|
( new (*boost::move_upmu::pnothrow)T ( ::boost::forward<P0>(p0)
|
||||||
|
, ::boost::forward<P1>(p1)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
//3 arg
|
//3 arg
|
||||||
template<class T, class P0, class P1, class P2>
|
template<class T, class P0, class P1, class P2>
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
@@ -115,6 +163,21 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class P0, class P1, class P2>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow ( BOOST_FWD_REF(P0) p0
|
||||||
|
, BOOST_FWD_REF(P1) p1
|
||||||
|
, BOOST_FWD_REF(P2) p2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return unique_ptr<T>
|
||||||
|
( new (*boost::move_upmu::pnothrow)T ( ::boost::forward<P0>(p0)
|
||||||
|
, ::boost::forward<P1>(p1)
|
||||||
|
, ::boost::forward<P2>(p2)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
//4 arg
|
//4 arg
|
||||||
template<class T, class P0, class P1, class P2, class P3>
|
template<class T, class P0, class P1, class P2, class P3>
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
@@ -132,6 +195,23 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class P0, class P1, class P2, class P3>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow ( BOOST_FWD_REF(P0) p0
|
||||||
|
, BOOST_FWD_REF(P1) p1
|
||||||
|
, BOOST_FWD_REF(P2) p2
|
||||||
|
, BOOST_FWD_REF(P3) p3
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return unique_ptr<T>
|
||||||
|
( new (*boost::move_upmu::pnothrow)T ( ::boost::forward<P0>(p0)
|
||||||
|
, ::boost::forward<P1>(p1)
|
||||||
|
, ::boost::forward<P2>(p2)
|
||||||
|
, ::boost::forward<P3>(p3)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
//5 arg
|
//5 arg
|
||||||
template<class T, class P0, class P1, class P2, class P3, class P4>
|
template<class T, class P0, class P1, class P2, class P3, class P4>
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
@@ -151,6 +231,25 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class P0, class P1, class P2, class P3, class P4>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow ( BOOST_FWD_REF(P0) p0
|
||||||
|
, BOOST_FWD_REF(P1) p1
|
||||||
|
, BOOST_FWD_REF(P2) p2
|
||||||
|
, BOOST_FWD_REF(P3) p3
|
||||||
|
, BOOST_FWD_REF(P4) p4
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return unique_ptr<T>
|
||||||
|
( new (*boost::move_upmu::pnothrow)T ( ::boost::forward<P0>(p0)
|
||||||
|
, ::boost::forward<P1>(p1)
|
||||||
|
, ::boost::forward<P2>(p2)
|
||||||
|
, ::boost::forward<P3>(p3)
|
||||||
|
, ::boost::forward<P4>(p4)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
//6 arg
|
//6 arg
|
||||||
template<class T, class P0, class P1, class P2, class P3, class P4, class P5>
|
template<class T, class P0, class P1, class P2, class P3, class P4, class P5>
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
@@ -172,6 +271,27 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class P0, class P1, class P2, class P3, class P4, class P5>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow ( BOOST_FWD_REF(P0) p0
|
||||||
|
, BOOST_FWD_REF(P1) p1
|
||||||
|
, BOOST_FWD_REF(P2) p2
|
||||||
|
, BOOST_FWD_REF(P3) p3
|
||||||
|
, BOOST_FWD_REF(P4) p4
|
||||||
|
, BOOST_FWD_REF(P5) p5
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return unique_ptr<T>
|
||||||
|
( new (*boost::move_upmu::pnothrow)T ( ::boost::forward<P0>(p0)
|
||||||
|
, ::boost::forward<P1>(p1)
|
||||||
|
, ::boost::forward<P2>(p2)
|
||||||
|
, ::boost::forward<P3>(p3)
|
||||||
|
, ::boost::forward<P4>(p4)
|
||||||
|
, ::boost::forward<P5>(p5)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
//7 arg
|
//7 arg
|
||||||
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6>
|
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6>
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
@@ -195,6 +315,30 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow ( BOOST_FWD_REF(P0) p0
|
||||||
|
, BOOST_FWD_REF(P1) p1
|
||||||
|
, BOOST_FWD_REF(P2) p2
|
||||||
|
, BOOST_FWD_REF(P3) p3
|
||||||
|
, BOOST_FWD_REF(P4) p4
|
||||||
|
, BOOST_FWD_REF(P5) p5
|
||||||
|
, BOOST_FWD_REF(P6) p6
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return unique_ptr<T>
|
||||||
|
( new (*boost::move_upmu::pnothrow)T ( ::boost::forward<P0>(p0)
|
||||||
|
, ::boost::forward<P1>(p1)
|
||||||
|
, ::boost::forward<P2>(p2)
|
||||||
|
, ::boost::forward<P3>(p3)
|
||||||
|
, ::boost::forward<P4>(p4)
|
||||||
|
, ::boost::forward<P5>(p5)
|
||||||
|
, ::boost::forward<P6>(p6)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//8 arg
|
//8 arg
|
||||||
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7>
|
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7>
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
@@ -220,6 +364,31 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow ( BOOST_FWD_REF(P0) p0
|
||||||
|
, BOOST_FWD_REF(P1) p1
|
||||||
|
, BOOST_FWD_REF(P2) p2
|
||||||
|
, BOOST_FWD_REF(P3) p3
|
||||||
|
, BOOST_FWD_REF(P4) p4
|
||||||
|
, BOOST_FWD_REF(P5) p5
|
||||||
|
, BOOST_FWD_REF(P6) p6
|
||||||
|
, BOOST_FWD_REF(P7) p7
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return unique_ptr<T>
|
||||||
|
( new (*boost::move_upmu::pnothrow)T ( ::boost::forward<P0>(p0)
|
||||||
|
, ::boost::forward<P1>(p1)
|
||||||
|
, ::boost::forward<P2>(p2)
|
||||||
|
, ::boost::forward<P3>(p3)
|
||||||
|
, ::boost::forward<P4>(p4)
|
||||||
|
, ::boost::forward<P5>(p5)
|
||||||
|
, ::boost::forward<P6>(p6)
|
||||||
|
, ::boost::forward<P7>(p7)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
//9 arg
|
//9 arg
|
||||||
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
|
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
@@ -247,6 +416,33 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow ( BOOST_FWD_REF(P0) p0
|
||||||
|
, BOOST_FWD_REF(P1) p1
|
||||||
|
, BOOST_FWD_REF(P2) p2
|
||||||
|
, BOOST_FWD_REF(P3) p3
|
||||||
|
, BOOST_FWD_REF(P4) p4
|
||||||
|
, BOOST_FWD_REF(P5) p5
|
||||||
|
, BOOST_FWD_REF(P6) p6
|
||||||
|
, BOOST_FWD_REF(P7) p7
|
||||||
|
, BOOST_FWD_REF(P8) p8
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return unique_ptr<T>
|
||||||
|
( new (*boost::move_upmu::pnothrow)T ( ::boost::forward<P0>(p0)
|
||||||
|
, ::boost::forward<P1>(p1)
|
||||||
|
, ::boost::forward<P2>(p2)
|
||||||
|
, ::boost::forward<P3>(p3)
|
||||||
|
, ::boost::forward<P4>(p4)
|
||||||
|
, ::boost::forward<P5>(p5)
|
||||||
|
, ::boost::forward<P6>(p6)
|
||||||
|
, ::boost::forward<P7>(p7)
|
||||||
|
, ::boost::forward<P8>(p8)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
//10 arg
|
//10 arg
|
||||||
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9>
|
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9>
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
@@ -277,6 +473,35 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9>
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array
|
||||||
|
make_unique_nothrow ( BOOST_FWD_REF(P0) p0
|
||||||
|
, BOOST_FWD_REF(P1) p1
|
||||||
|
, BOOST_FWD_REF(P2) p2
|
||||||
|
, BOOST_FWD_REF(P3) p3
|
||||||
|
, BOOST_FWD_REF(P4) p4
|
||||||
|
, BOOST_FWD_REF(P5) p5
|
||||||
|
, BOOST_FWD_REF(P6) p6
|
||||||
|
, BOOST_FWD_REF(P7) p7
|
||||||
|
, BOOST_FWD_REF(P8) p8
|
||||||
|
, BOOST_FWD_REF(P9) p9
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return unique_ptr<T>
|
||||||
|
( new (*boost::move_upmu::pnothrow)T ( ::boost::forward<P0>(p0)
|
||||||
|
, ::boost::forward<P1>(p1)
|
||||||
|
, ::boost::forward<P2>(p2)
|
||||||
|
, ::boost::forward<P3>(p3)
|
||||||
|
, ::boost::forward<P4>(p4)
|
||||||
|
, ::boost::forward<P5>(p5)
|
||||||
|
, ::boost::forward<P6>(p6)
|
||||||
|
, ::boost::forward<P7>(p7)
|
||||||
|
, ::boost::forward<P8>(p8)
|
||||||
|
, ::boost::forward<P9>(p9)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is not an array.
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is not an array.
|
||||||
@@ -290,6 +515,17 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
return unique_ptr<T>(new T);
|
return unique_ptr<T>(new T);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is not an array.
|
||||||
|
//!
|
||||||
|
//! <b>Returns</b>: <tt>unique_ptr<T>(new T(std::nothrow)</tt> (default initialization)
|
||||||
|
template<class T>
|
||||||
|
inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_not_array)
|
||||||
|
make_unique_nothrow_definit()
|
||||||
|
{
|
||||||
|
return unique_ptr<T>(new (*boost::move_upmu::pnothrow)T);
|
||||||
|
}
|
||||||
|
|
||||||
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is an array of
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is an array of
|
||||||
//! unknown bound.
|
//! unknown bound.
|
||||||
//!
|
//!
|
||||||
@@ -303,6 +539,19 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
return unique_ptr<T>(new U[n]());
|
return unique_ptr<T>(new U[n]());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is an array of
|
||||||
|
//! unknown bound.
|
||||||
|
//!
|
||||||
|
//! <b>Returns</b>: <tt>unique_ptr<T>(new (std::nothrow)remove_extent_t<T>[n]())</tt> (value initialization)
|
||||||
|
template<class T>
|
||||||
|
inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_array_of_unknown_bound)
|
||||||
|
make_unique_nothrow(std::size_t n)
|
||||||
|
{
|
||||||
|
typedef typename ::boost::move_upmu::remove_extent<T>::type U;
|
||||||
|
return unique_ptr<T>(new (*boost::move_upmu::pnothrow)U[n]());
|
||||||
|
}
|
||||||
|
|
||||||
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is an array of
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is an array of
|
||||||
//! unknown bound.
|
//! unknown bound.
|
||||||
//!
|
//!
|
||||||
@@ -316,6 +565,19 @@ inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
|||||||
return unique_ptr<T>(new U[n]);
|
return unique_ptr<T>(new U[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is an array of
|
||||||
|
//! unknown bound.
|
||||||
|
//!
|
||||||
|
//! <b>Returns</b>: <tt>unique_ptr<T>(new (std::nothrow)remove_extent_t<T>[n])</tt> (default initialization)
|
||||||
|
template<class T>
|
||||||
|
inline BOOST_MOVE_DOC1ST(unique_ptr<T>,
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_array_of_unknown_bound)
|
||||||
|
make_unique_nothrow_definit(std::size_t n)
|
||||||
|
{
|
||||||
|
typedef typename ::boost::move_upmu::remove_extent<T>::type U;
|
||||||
|
return unique_ptr<T>(new (*boost::move_upmu::pnothrow) U[n]);
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
||||||
|
|
||||||
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is
|
||||||
@@ -324,6 +586,28 @@ template<class T, class... Args>
|
|||||||
inline BOOST_MOVE_DOC1ST(unspecified,
|
inline BOOST_MOVE_DOC1ST(unspecified,
|
||||||
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_array_of_known_bound)
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_array_of_known_bound)
|
||||||
make_unique(BOOST_FWD_REF(Args) ...) = delete;
|
make_unique(BOOST_FWD_REF(Args) ...) = delete;
|
||||||
|
|
||||||
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is
|
||||||
|
//! an array of known bound.
|
||||||
|
template<class T, class... Args>
|
||||||
|
inline BOOST_MOVE_DOC1ST(unspecified,
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_array_of_known_bound)
|
||||||
|
make_unique_definit(BOOST_FWD_REF(Args) ...) = delete;
|
||||||
|
|
||||||
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is
|
||||||
|
//! an array of known bound.
|
||||||
|
template<class T, class... Args>
|
||||||
|
inline BOOST_MOVE_DOC1ST(unspecified,
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_array_of_known_bound)
|
||||||
|
make_unique_nothrow(BOOST_FWD_REF(Args) ...) = delete;
|
||||||
|
|
||||||
|
//! <b>Remarks</b>: This function shall not participate in overload resolution unless T is
|
||||||
|
//! an array of known bound.
|
||||||
|
template<class T, class... Args>
|
||||||
|
inline BOOST_MOVE_DOC1ST(unspecified,
|
||||||
|
typename ::boost::move_upmu::unique_ptr_if<T>::t_is_array_of_known_bound)
|
||||||
|
make_unique_nothrow_definit(BOOST_FWD_REF(Args) ...) = delete;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} //namespace movelib {
|
} //namespace movelib {
|
||||||
|
@@ -44,6 +44,8 @@ void reset_counters()
|
|||||||
static const unsigned PatternSize = 8;
|
static const unsigned PatternSize = 8;
|
||||||
static const unsigned char ff_patternbuf[PatternSize] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
static const unsigned char ff_patternbuf[PatternSize] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||||
static const unsigned char ee_patternbuf[PatternSize] = { 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE };
|
static const unsigned char ee_patternbuf[PatternSize] = { 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE };
|
||||||
|
static const unsigned char dd_patternbuf[PatternSize] = { 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD };
|
||||||
|
static const unsigned char cc_patternbuf[PatternSize] = { 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC };
|
||||||
|
|
||||||
struct default_init
|
struct default_init
|
||||||
{
|
{
|
||||||
@@ -57,6 +59,16 @@ struct default_init
|
|||||||
void *const p = ::operator new[](sz);
|
void *const p = ::operator new[](sz);
|
||||||
return std::memset(p, 0xEE, sz);
|
return std::memset(p, 0xEE, sz);
|
||||||
}
|
}
|
||||||
|
static void* operator new(std::size_t sz, const std::nothrow_t &)
|
||||||
|
{
|
||||||
|
void *const p = ::operator new(sz);
|
||||||
|
return std::memset(p, 0xDD, sz);
|
||||||
|
}
|
||||||
|
static void* operator new[](std::size_t sz, const std::nothrow_t &)
|
||||||
|
{
|
||||||
|
void *const p = ::operator new[](sz);
|
||||||
|
return std::memset(p, 0xCC, sz);
|
||||||
|
}
|
||||||
unsigned char buf[PatternSize];
|
unsigned char buf[PatternSize];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,6 +90,11 @@ void test()
|
|||||||
bml::unique_ptr<default_init> p(bml::make_unique_definit<default_init>());
|
bml::unique_ptr<default_init> p(bml::make_unique_definit<default_init>());
|
||||||
BOOST_TEST(0 == std::memcmp(p.get(), ff_patternbuf, sizeof(ff_patternbuf)));
|
BOOST_TEST(0 == std::memcmp(p.get(), ff_patternbuf, sizeof(ff_patternbuf)));
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
bml::unique_ptr<default_init> p(bml::make_unique_nothrow_definit<default_init>());
|
||||||
|
BOOST_TEST(0 == std::memcmp(p.get(), dd_patternbuf, sizeof(dd_patternbuf)));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_TEST(A::count == 0);
|
BOOST_TEST(A::count == 0);
|
||||||
{
|
{
|
||||||
bml::unique_ptr<A> p(bml::make_unique<A>());
|
bml::unique_ptr<A> p(bml::make_unique<A>());
|
||||||
@@ -88,7 +105,7 @@ void test()
|
|||||||
}
|
}
|
||||||
BOOST_TEST(A::count == 0);
|
BOOST_TEST(A::count == 0);
|
||||||
{
|
{
|
||||||
bml::unique_ptr<A> p(bml::make_unique<A>(0));
|
bml::unique_ptr<A> p(bml::make_unique_nothrow<A>(0));
|
||||||
BOOST_TEST(A::count == 1);
|
BOOST_TEST(A::count == 1);
|
||||||
BOOST_TEST(p->a == 0);
|
BOOST_TEST(p->a == 0);
|
||||||
BOOST_TEST(p->b == 1000);
|
BOOST_TEST(p->b == 1000);
|
||||||
@@ -104,7 +121,7 @@ void test()
|
|||||||
}
|
}
|
||||||
BOOST_TEST(A::count == 0);
|
BOOST_TEST(A::count == 0);
|
||||||
{
|
{
|
||||||
bml::unique_ptr<A> p(bml::make_unique<A>(0, 1, 2));
|
bml::unique_ptr<A> p(bml::make_unique_nothrow<A>(0, 1, 2));
|
||||||
BOOST_TEST(A::count == 1);
|
BOOST_TEST(A::count == 1);
|
||||||
BOOST_TEST(p->a == 0);
|
BOOST_TEST(p->a == 0);
|
||||||
BOOST_TEST(p->b == 1);
|
BOOST_TEST(p->b == 1);
|
||||||
@@ -115,6 +132,7 @@ void test()
|
|||||||
|
|
||||||
} //namespace make_unique_single{
|
} //namespace make_unique_single{
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
// make_unique_single
|
// make_unique_single
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
@@ -135,6 +153,16 @@ void test()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
BOOST_TEST(A::count == 0);
|
BOOST_TEST(A::count == 0);
|
||||||
|
{
|
||||||
|
bml::unique_ptr<A[]> p(bml::make_unique_nothrow<A[]>(10));
|
||||||
|
BOOST_TEST(A::count == 10);
|
||||||
|
for(int i = 0; i != 10; ++i){
|
||||||
|
BOOST_TEST(p[i].a == 999);
|
||||||
|
BOOST_TEST(p[i].b == 1000);
|
||||||
|
BOOST_TEST(p[i].c == 1001);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BOOST_TEST(A::count == 0);
|
||||||
reset_counters();
|
reset_counters();
|
||||||
{
|
{
|
||||||
bml::unique_ptr<default_init[]> p(bml::make_unique_definit<default_init[]>(10));
|
bml::unique_ptr<default_init[]> p(bml::make_unique_definit<default_init[]>(10));
|
||||||
@@ -142,6 +170,13 @@ void test()
|
|||||||
BOOST_TEST(0 == std::memcmp(&p[i], ee_patternbuf, sizeof(ee_patternbuf)));
|
BOOST_TEST(0 == std::memcmp(&p[i], ee_patternbuf, sizeof(ee_patternbuf)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
reset_counters();
|
||||||
|
{
|
||||||
|
bml::unique_ptr<default_init[]> p(bml::make_unique_nothrow_definit<default_init[]>(10));
|
||||||
|
for(unsigned i = 0; i != 10; ++i){
|
||||||
|
BOOST_TEST(0 == std::memcmp(&p[i], cc_patternbuf, sizeof(cc_patternbuf)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace make_unique_array{
|
} //namespace make_unique_array{
|
||||||
|
Reference in New Issue
Block a user