30 #ifndef _ALLOCATED_PTR_H
31 #define _ALLOCATED_PTR_H 1
33 #if __cplusplus < 201103L
34 # include <bits/c++0xwarning.h>
40 namespace std _GLIBCXX_VISIBILITY(default)
42 _GLIBCXX_BEGIN_NAMESPACE_VERSION
45 template<
typename _Alloc>
57 template<
typename _Ptr,
58 typename _Req = _Require<is_same<_Ptr, value_type*>>>
66 : _M_alloc(__gd._M_alloc), _M_ptr(__gd._M_ptr)
67 { __gd._M_ptr =
nullptr; }
72 if (_M_ptr !=
nullptr)
85 value_type*
get() {
return std::__to_address(_M_ptr); }
93 template<
typename _Alloc>
94 __allocated_ptr<_Alloc>
100 _GLIBCXX_END_NAMESPACE_VERSION
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
ISO C++ entities toplevel namespace is std.
__allocated_ptr< _Alloc > __allocate_guarded(_Alloc &__a)
Allocate space for a single object using __a.
__detected_or_t< value_type *, __pointer, _Alloc > pointer
The allocator's pointer type.
static constexpr pointer allocate(_Alloc &__a, size_type __n)
Allocate memory.
_Alloc::value_type value_type
The allocated type.
static constexpr void deallocate(_Alloc &__a, pointer __p, size_type __n)
Deallocate memory.
Non-standard RAII type for managing pointers obtained from allocators.
__allocated_ptr(__allocated_ptr &&__gd) noexcept
Transfer ownership of the owned pointer.
value_type * get()
Get the address that the owned pointer refers to.
__allocated_ptr(_Alloc &__a, _Ptr __ptr)
Convert __ptr to allocator's pointer type and take ownership of it.
__allocated_ptr(_Alloc &__a, pointer __ptr) noexcept
Take ownership of __ptr.
~__allocated_ptr()
Deallocate the owned pointer.
__allocated_ptr & operator=(std::nullptr_t) noexcept
Release ownership of the owned pointer.
Uniform interface to all pointer-like types.