30 #ifndef _BACKWARD_AUTO_PTR_H
31 #define _BACKWARD_AUTO_PTR_H 1
33 #include <bits/c++config.h>
38 _GLIBCXX_BEGIN_NAMESPACE_VERSION
47 template<
typename _Tp1>
53 auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { }
54 } _GLIBCXX_DEPRECATED;
86 template<
typename _Tp>
94 typedef _Tp element_type;
103 auto_ptr(element_type* __p = 0)
throw() : _M_ptr(__p) { }
112 auto_ptr(auto_ptr& __a)
throw() : _M_ptr(__a.release()) { }
124 template<
typename _Tp1>
125 auto_ptr(auto_ptr<_Tp1>& __a)
throw() : _M_ptr(__a.release()) { }
136 operator=(auto_ptr& __a)
throw()
138 reset(__a.release());
152 template<
typename _Tp1>
154 operator=(auto_ptr<_Tp1>& __a)
throw()
156 reset(__a.release());
170 ~auto_ptr() {
delete _M_ptr; }
181 operator*()
const throw()
194 operator->()
const throw()
211 get()
const throw() {
return _M_ptr; }
227 element_type* __tmp = _M_ptr;
240 reset(element_type* __p = 0)
throw()
260 auto_ptr(auto_ptr_ref<element_type> __ref)
throw()
261 : _M_ptr(__ref._M_ptr) { }
264 operator=(auto_ptr_ref<element_type> __ref)
throw()
266 if (__ref._M_ptr != this->get())
269 _M_ptr = __ref._M_ptr;
274 template<
typename _Tp1>
275 operator auto_ptr_ref<_Tp1>()
throw()
276 {
return auto_ptr_ref<_Tp1>(this->release()); }
278 template<
typename _Tp1>
279 operator auto_ptr<_Tp1>()
throw()
280 {
return auto_ptr<_Tp1>(this->release()); }
281 } _GLIBCXX_DEPRECATED;
289 typedef void element_type;
290 } _GLIBCXX_DEPRECATED;
292 #if __cplusplus >= 201103L
293 template<_Lock_policy _Lp>
294 template<
typename _Tp>
296 __shared_count<_Lp>::__shared_count(std::auto_ptr<_Tp>&& __r)
297 : _M_pi(
new _Sp_counted_ptr<_Tp*, _Lp>(__r.get()))
300 template<
typename _Tp, _Lock_policy _Lp>
301 template<
typename _Tp1>
303 __shared_ptr<_Tp, _Lp>::__shared_ptr(std::auto_ptr<_Tp1>&& __r)
304 : _M_ptr(__r.get()), _M_refcount()
307 static_assert(
sizeof(_Tp1) > 0,
"incomplete type" );
308 _Tp1* __tmp = __r.get();
309 _M_refcount = __shared_count<_Lp>(std::move(__r));
310 __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
313 template<
typename _Tp>
314 template<
typename _Tp1>
316 shared_ptr<_Tp>::shared_ptr(std::auto_ptr<_Tp1>&& __r)
317 : __shared_ptr<_Tp>(std::move(__r)) { }
319 template<
typename _Tp,
typename _Dp>
320 template<
typename _Up,
typename>
322 unique_ptr<_Tp, _Dp>::unique_ptr(auto_ptr<_Up>&& __u) noexcept
323 : _M_t(__u.release(), deleter_type()) { }
326 _GLIBCXX_END_NAMESPACE_VERSION
#define __glibcxx_function_requires(...)
Definition: concept_check.h:47
#define _GLIBCXX_DEBUG_ASSERT(_Condition)
Definition: debug.h:61
namespace std _GLIBCXX_VISIBILITY(default)
Definition: auto_ptr.h:36