mirror of
https://github.com/boostorg/move.git
synced 2026-07-04 23:50:53 +02:00
Extracted default_delete into its own header.
Extracted meta utilities used only by unique_ptr and friends to its own "unique_ptr_meta_utils.hpp" header.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/move/default_delete.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "unique_ptr_test_utils_beg.hpp"
|
||||
|
||||
namespace bml = ::boost::movelib;
|
||||
namespace bmupmu = ::boost::move_upmu;
|
||||
|
||||
////////////////////////////////
|
||||
// unique_ptr_ctor_move_defdel
|
||||
@@ -266,7 +267,7 @@ void test()
|
||||
{
|
||||
//Single unique_ptr
|
||||
reset_counters();
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_convertible<B, A>::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_convertible<B, A>::value));
|
||||
{
|
||||
bml::unique_ptr<B, move_constr_deleter<B> > s(new B);
|
||||
A* p = s.get();
|
||||
|
||||
@@ -71,13 +71,13 @@ class copy_constr_deleter
|
||||
|
||||
template<class U>
|
||||
copy_constr_deleter(const copy_constr_deleter<U>&
|
||||
, typename boost::move_detail::enable_def_del<U, T>::type* =0)
|
||||
, typename boost::move_upd::enable_def_del<U, T>::type* =0)
|
||||
{ state_ = 5; }
|
||||
|
||||
explicit copy_constr_deleter(int s) : state_(s) {}
|
||||
|
||||
template <class U>
|
||||
typename boost::move_detail::enable_def_del<U, T, copy_constr_deleter&>::type
|
||||
typename boost::move_upd::enable_def_del<U, T, copy_constr_deleter&>::type
|
||||
operator=(const copy_constr_deleter<U> &d)
|
||||
{
|
||||
state_ = d.state();
|
||||
@@ -117,7 +117,7 @@ class move_constr_deleter
|
||||
|
||||
template <class U>
|
||||
move_constr_deleter(BOOST_RV_REF(move_constr_deleter<U>) d
|
||||
, typename boost::move_detail::enable_def_del<U, T>::type* =0)
|
||||
, typename boost::move_upd::enable_def_del<U, T>::type* =0)
|
||||
: state_(d.state())
|
||||
{ d.set_state(0); }
|
||||
|
||||
@@ -129,7 +129,7 @@ class move_constr_deleter
|
||||
}
|
||||
|
||||
template <class U>
|
||||
typename boost::move_detail::enable_def_del<U, T, move_constr_deleter&>::type
|
||||
typename boost::move_upd::enable_def_del<U, T, move_constr_deleter&>::type
|
||||
operator=(BOOST_RV_REF(move_constr_deleter<U>) d)
|
||||
{
|
||||
state_ = d.state();
|
||||
|
||||
+16
-15
@@ -32,6 +32,7 @@
|
||||
#include "unique_ptr_test_utils_beg.hpp"
|
||||
|
||||
namespace bml = ::boost::movelib;
|
||||
namespace bmupmu = ::boost::move_upmu;
|
||||
|
||||
////////////////////////////////
|
||||
// unique_ptr_pointer_type
|
||||
@@ -49,29 +50,29 @@ void test()
|
||||
//Single unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::pointer, int*>::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, int*>::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int, Deleter> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::pointer, Deleter::pointer>::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
}
|
||||
//Unbounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int[]> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::pointer, int*>::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, int*>::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int[], Deleter> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::pointer, Deleter::pointer>::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
}
|
||||
//Bounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int[5]> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::pointer, int*>::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, int*>::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int[5], Deleter> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::pointer, Deleter::pointer>::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,29 +92,29 @@ void test()
|
||||
//Single unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::deleter_type, bml::default_delete<int> >::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, bml::default_delete<int> >::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int, Deleter> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::deleter_type, Deleter >::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, Deleter >::value));
|
||||
}
|
||||
//Unbounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int[]> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::deleter_type, bml::default_delete<int[]> >::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, bml::default_delete<int[]> >::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int[], Deleter> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::deleter_type, Deleter >::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, Deleter >::value));
|
||||
}
|
||||
//Bounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<int[2]> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::deleter_type, bml::default_delete<int[2]> >::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, bml::default_delete<int[2]> >::value));
|
||||
}
|
||||
{
|
||||
typedef bml::unique_ptr<int[2], Deleter> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::deleter_type, Deleter >::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::deleter_type, Deleter >::value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,17 +131,17 @@ void test()
|
||||
//Single unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<const int> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::element_type, const int>::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::element_type, const int>::value));
|
||||
}
|
||||
//Unbounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<const int[]> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::element_type, const int>::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::element_type, const int>::value));
|
||||
}
|
||||
//Bounded array unique_ptr
|
||||
{
|
||||
typedef bml::unique_ptr<const int[2]> P;
|
||||
BOOST_STATIC_ASSERT((boost::move_detail::is_same<P::element_type, const int>::value));
|
||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::element_type, const int>::value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user