// auto_ptr implementation -*- C++ -*-
-// Copyright (C) 2007-2013 Free Software Foundation, Inc.
+// Copyright (C) 2007-2020 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { }
} _GLIBCXX_DEPRECATED;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/**
* @brief A simple smart pointer providing strict ownership semantics.
element_type&
operator*() const throw()
{
- _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+ __glibcxx_assert(_M_ptr != 0);
return *_M_ptr;
}
element_type*
operator->() const throw()
{
- _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+ __glibcxx_assert(_M_ptr != 0);
return _M_ptr;
}
/**
* @brief Automatic conversions
*
- * These operations convert an %auto_ptr into and from an auto_ptr_ref
- * automatically as needed. This allows constructs such as
+ * These operations are supposed to convert an %auto_ptr into and from
+ * an auto_ptr_ref automatically as needed. This would allow
+ * constructs such as
* @code
* auto_ptr<Derived> func_returning_auto_ptr(.....);
* ...
* auto_ptr<Base> ptr = func_returning_auto_ptr(.....);
* @endcode
+ *
+ * But it doesn't work, and won't be fixed. For further details see
+ * http://cplusplus.github.io/LWG/lwg-closed.html#463
*/
auto_ptr(auto_ptr_ref<element_type> __ref) throw()
: _M_ptr(__ref._M_ptr) { }
{ __r.release(); }
template<typename _Tp, _Lock_policy _Lp>
- template<typename _Tp1>
+ template<typename _Tp1, typename>
inline
__shared_ptr<_Tp, _Lp>::__shared_ptr(std::auto_ptr<_Tp1>&& __r)
: _M_ptr(__r.get()), _M_refcount()
static_assert( sizeof(_Tp1) > 0, "incomplete type" );
_Tp1* __tmp = __r.get();
_M_refcount = __shared_count<_Lp>(std::move(__r));
- __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
+ _M_enable_shared_from_this_with(__tmp);
}
template<typename _Tp>
- template<typename _Tp1>
+ template<typename _Tp1, typename>
inline
shared_ptr<_Tp>::shared_ptr(std::auto_ptr<_Tp1>&& __r)
: __shared_ptr<_Tp>(std::move(__r)) { }
: _M_t(__u.release(), deleter_type()) { }
#endif
+#pragma GCC diagnostic pop
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace