class __shared_ptr<__libfund_v1<_Tp, false>, _Lp>
: private __shared_ptr<_Tp, _Lp>
{
- template<typename _Tp1>
+ template<typename _Tp1, typename _Res = void>
using _Compatible
- = enable_if_t<__sp_compatible<_Tp1, _Tp>::value>;
+ = enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>;
using _Base_type = __shared_ptr<_Tp>;
using _Base_type::operator->;
template<typename _Tp1>
- __shared_ptr&
+ _Compatible<_Tp1, __shared_ptr&>
operator=(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept
{
_Base_type::operator=(__r._M_get_base());
}
template<class _Tp1>
- __shared_ptr&
+ _Compatible<_Tp1, __shared_ptr&>
operator=(__shared_ptr<__libfund_v1<_Tp1>, _Lp>&& __r) noexcept
{
_Base_type::operator=(std::move(__r._M_get_base()));
}
template<typename _Tp1>
- __shared_ptr&
+ _Compatible<_Tp1, __shared_ptr&>
operator=(std::unique_ptr<_Tp1>&& __r)
{
_Base_type::operator=(std::move(__r));
#if _GLIBCXX_USE_DEPRECATED
template<typename _Tp1>
- __shared_ptr&
+ _Compatible<_Tp1, __shared_ptr&>
operator=(std::auto_ptr<_Tp1>&& __r)
{
_Base_type::operator=(std::move(__r));
using element_type = remove_extent_t<_Tp>;
private:
- struct _Array_Deleter
+ struct _Array_deleter
{
void
operator()(element_type const *__p) const
{ delete [] __p; }
};
- struct _Normal_Deleter
- {
- void
- operator()(element_type const *__p) const
- { delete __p; }
- };
-
- template<typename _Tp1>
+ template<typename _Tp1, typename _Res = void>
using _Compatible
- = enable_if_t<__sp_compatible<_Tp1, _Tp>::value>;
-
- using _Deleter_type
- = conditional_t<is_array<_Tp>::value, _Array_Deleter, _Normal_Deleter>;
+ = enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>;
using _Base_type = __shared_ptr<element_type>;
template<typename _Tp1>
explicit __shared_ptr(_Tp1* __p)
- : _Base_type(__p, _Deleter_type())
+ : _Base_type(__p, _Array_deleter())
{ }
template<typename _Tp1, typename _Deleter>
reset(_Tp1* __p)
{
_GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != get());
- __shared_ptr(__p, _Deleter_type()).swap(*this);
+ __shared_ptr(__p, _Array_deleter()).swap(*this);
}
template<typename _Tp1, typename _Deleter>
}
template<typename _Tp1>
- __shared_ptr&
+ _Compatible<_Tp1, __shared_ptr&>
operator=(const __shared_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept
{
_Base_type::operator=(__r._M_get_base());
}
template<class _Tp1>
- __shared_ptr&
+ _Compatible<_Tp1, __shared_ptr&>
operator=(__shared_ptr<__libfund_v1<_Tp1>, _Lp>&& __r) noexcept
{
_Base_type::operator=(std::move(__r._M_get_base()));
}
template<typename _Tp1>
- __shared_ptr&
+ _Compatible<_Tp1, __shared_ptr&>
operator=(std::unique_ptr<_Tp1>&& __r)
{
_Base_type::operator=(std::move(__r));
#if _GLIBCXX_USE_DEPRECATED
template<typename _Tp1>
- __shared_ptr&
+ _Compatible<_Tp1, __shared_ptr&>
operator=(std::auto_ptr<_Tp1>&& __r)
{
_Base_type::operator=(std::move(__r));
class __weak_ptr<__libfund_v1<_Tp>, _Lp>
: __weak_ptr<remove_extent_t<_Tp>, _Lp>
{
- template<typename _Tp1>
- using _Compatible = enable_if_t<__sp_compatible<_Tp1, _Tp>::value>;
+ template<typename _Tp1, typename _Res = void>
+ using _Compatible
+ = enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>;
using _Base_type = __weak_ptr<remove_extent_t<_Tp>>;
operator=(const __weak_ptr& __r) noexcept = default;
template<typename _Tp1>
- __weak_ptr&
+ _Compatible<_Tp1, __weak_ptr&>
operator=(const __weak_ptr<__libfund_v1<_Tp1>, _Lp>& __r) noexcept
{
this->_Base_type::operator=(__r._M_get_base());
}
template<typename _Tp1>
- __weak_ptr&
+ _Compatible<_Tp1, __weak_ptr&>
operator=(const __shared_ptr<_Tp1, _Lp>& __r) noexcept
{
this->_Base_type::operator=(__r._M_get_base());
}
template<typename _Tp1>
- __weak_ptr&
+ _Compatible<_Tp1, __weak_ptr&>
operator=(__weak_ptr<_Tp1, _Lp>&& __r) noexcept
{
this->_Base_type::operator=(std::move(__r._M_get_base()));
template<typename _Tp>
class shared_ptr : public __shared_ptr<_Tp>
{
- template<typename _Tp1>
- using _Compatible = enable_if_t<__sp_compatible<_Tp1, _Tp>::value>;
+ template<typename _Tp1, typename _Res = void>
+ using _Compatible
+ = enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>;
using _Base_type = __shared_ptr<_Tp>;
shared_ptr& operator=(const shared_ptr&) noexcept = default;
template <typename _Tp1>
- shared_ptr&
+ _Compatible<_Tp1, shared_ptr&>
operator=(const shared_ptr<_Tp1>& __r) noexcept
{
_Base_type::operator=(__r);
}
template <typename _Tp1>
- shared_ptr&
+ _Compatible<_Tp1, shared_ptr&>
operator=(shared_ptr<_Tp1>&& __r) noexcept
{
_Base_type::operator=(std::move(__r));
#if _GLIBCXX_USE_DEPRECATED
template<typename _Tp1>
- shared_ptr&
+ _Compatible<_Tp1, shared_ptr&>
operator=(std::auto_ptr<_Tp1>&& __r)
{
__shared_ptr<_Tp>::operator=(std::move(__r));
#endif
template <typename _Tp1, typename _Del>
- shared_ptr&
+ _Compatible<_Tp1, shared_ptr&>
operator=(unique_ptr<_Tp1, _Del>&& __r)
{
_Base_type::operator=(std::move(__r));
template<typename _Tp>
class weak_ptr : public __weak_ptr<_Tp>
{
- template<typename _Tp1>
- using _Compatible = enable_if_t<__sp_compatible<_Tp1, _Tp>::value>;
+ template<typename _Tp1, typename _Res = void>
+ using _Compatible
+ = enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>;
using _Base_type = __weak_ptr<_Tp>;
operator=(const weak_ptr& __r) noexcept = default;
template<typename _Tp1>
- weak_ptr&
+ _Compatible<_Tp1, weak_ptr&>
operator=(const weak_ptr<_Tp1>& __r) noexcept
{
this->_Base_type::operator=(__r);
}
template<typename _Tp1>
- weak_ptr&
+ _Compatible<_Tp1, weak_ptr&>
operator=(const shared_ptr<_Tp1>& __r) noexcept
{
this->_Base_type::operator=(__r);
operator=(weak_ptr&& __r) noexcept = default;
template<typename _Tp1>
- weak_ptr&
+ _Compatible<_Tp1, weak_ptr&>
operator=(weak_ptr<_Tp1>&& __r) noexcept
{
this->_Base_type::operator=(std::move(__r));