mirror of
https://github.com/boostorg/move.git
synced 2025-08-01 05:14:27 +02:00
Fixed Trac #12920 ("movelib::unique_ptr: incorrect pointer type for nested array")
This commit is contained in:
@@ -788,6 +788,13 @@ Many thanks to all boosters that have tested, reviewed and improved the library.
|
|||||||
|
|
||||||
[section:release_notes Release Notes]
|
[section:release_notes Release Notes]
|
||||||
|
|
||||||
|
[section:release_notes_boost_1_64 Boost 1.64 Release]
|
||||||
|
|
||||||
|
* Fixed bug:
|
||||||
|
* [@https://svn.boost.org/trac/boost/ticket/12920 #12920 ['"movelib::unique_ptr: incorrect pointer type for nested array"]].
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
[section:release_notes_boost_1_62 Boost 1.62 Release]
|
[section:release_notes_boost_1_62 Boost 1.62 Release]
|
||||||
|
|
||||||
* Documented new limitations reported in Trac tickets
|
* Documented new limitations reported in Trac tickets
|
||||||
|
@@ -96,6 +96,22 @@ typedef int bool_conversion::* explicit_bool_arg;
|
|||||||
typedef int (bool_conversion::*nullptr_type)();
|
typedef int (bool_conversion::*nullptr_type)();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
template<bool B>
|
||||||
|
struct is_array_del
|
||||||
|
{};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void call_delete(T *p, is_array_del<true>)
|
||||||
|
{
|
||||||
|
delete [] p;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void call_delete(T *p, is_array_del<false>)
|
||||||
|
{
|
||||||
|
delete p;
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace move_upd {
|
} //namespace move_upd {
|
||||||
// @endcond
|
// @endcond
|
||||||
|
|
||||||
@@ -184,7 +200,7 @@ struct default_delete
|
|||||||
//and T has no virtual destructor, then you have a problem
|
//and T has no virtual destructor, then you have a problem
|
||||||
BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor<default_delete, U>::value ));
|
BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor<default_delete, U>::value ));
|
||||||
element_type * const p = static_cast<element_type*>(ptr);
|
element_type * const p = static_cast<element_type*>(ptr);
|
||||||
bmupmu::is_array<T>::value ? delete [] p : delete p;
|
move_upd::call_delete(p, move_upd::is_array_del<bmupmu::is_array<T>::value>());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Effects</b>: Same as <tt>(*this)(static_cast<element_type*>(nullptr))</tt>.
|
//! <b>Effects</b>: Same as <tt>(*this)(static_cast<element_type*>(nullptr))</tt>.
|
||||||
|
@@ -397,7 +397,7 @@ struct pointer_type_imp
|
|||||||
template <class T, class D>
|
template <class T, class D>
|
||||||
struct pointer_type_imp<T, D, false>
|
struct pointer_type_imp<T, D, false>
|
||||||
{
|
{
|
||||||
typedef typename remove_extent<T>::type* type;
|
typedef T* type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T, class D>
|
template <class T, class D>
|
||||||
|
@@ -75,6 +75,17 @@ void test()
|
|||||||
typedef bml::unique_ptr<int[5], Deleter> P;
|
typedef bml::unique_ptr<int[5], Deleter> P;
|
||||||
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||||
}
|
}
|
||||||
|
//Unbounded array of bounded array unique_ptr
|
||||||
|
{
|
||||||
|
typedef int int_5_t [5];
|
||||||
|
typedef bml::unique_ptr<int_5_t[]> P;
|
||||||
|
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, int_5_t*>::value));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef int int_5_t [5];
|
||||||
|
typedef bml::unique_ptr<int_5_t[], Deleter> P;
|
||||||
|
BOOST_STATIC_ASSERT((bmupmu::is_same<P::pointer, Deleter::pointer>::value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace unique_ptr_pointer_type {
|
} //namespace unique_ptr_pointer_type {
|
||||||
|
Reference in New Issue
Block a user